diff --git a/src/Portal/Sucrose.Portal/Views/Controls/LibraryCard.xaml b/src/Portal/Sucrose.Portal/Views/Controls/LibraryCard.xaml index 9a0ec9953..1f9133f65 100644 --- a/src/Portal/Sucrose.Portal/Views/Controls/LibraryCard.xaml +++ b/src/Portal/Sucrose.Portal/Views/Controls/LibraryCard.xaml @@ -39,28 +39,38 @@ - - - + + + + - + + + + - + - - - - - - - - - - + + + + + + + + + + + + + + + - - + + + diff --git a/src/Portal/Sucrose.Portal/Views/Controls/LibraryCard.xaml.cs b/src/Portal/Sucrose.Portal/Views/Controls/LibraryCard.xaml.cs index ff59c570e..b66d2e8d2 100644 --- a/src/Portal/Sucrose.Portal/Views/Controls/LibraryCard.xaml.cs +++ b/src/Portal/Sucrose.Portal/Views/Controls/LibraryCard.xaml.cs @@ -221,24 +221,32 @@ private void LibraryCard_MouseEnter(object sender, MouseEventArgs e) } } - private void LibraryCard_Loaded(object sender, RoutedEventArgs e) + private async void LibraryCard_Loaded(object sender, RoutedEventArgs e) { - UpdateInfo(); - - if (Info.AppVersion.CompareTo(SHV.Entry()) > 0) + await Application.Current.Dispatcher.InvokeAsync(async () => { - ThemeMore.Visibility = Visibility.Collapsed; - IncompatibleVersion.Visibility = Visibility.Visible; - } + UpdateInfo(); - string ImagePath = Path.Combine(Theme, Info.Thumbnail); + if (Info.AppVersion.CompareTo(SHV.Entry()) > 0) + { + ThemeMore.Visibility = Visibility.Collapsed; + IncompatibleVersion.Visibility = Visibility.Visible; + } - if (File.Exists(ImagePath)) - { - Imagine.ImageSource = Loader.LoadOptimal(ImagePath); - } + string ImagePath = Path.Combine(Theme, Info.Thumbnail); - Dispose(); + if (File.Exists(ImagePath)) + { + Imagine.ImageSource = Loader.LoadOptimal(ImagePath); + } + + await Task.Delay(100); + + Card.Visibility = Visibility.Visible; + Progress.Visibility = Visibility.Collapsed; + + Dispose(); + }); } private void LibraryCard_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) diff --git a/src/Portal/Sucrose.Portal/Views/Pages/Library/FullLibraryPage.xaml.cs b/src/Portal/Sucrose.Portal/Views/Pages/Library/FullLibraryPage.xaml.cs index 05a8b6058..61608909f 100644 --- a/src/Portal/Sucrose.Portal/Views/Pages/Library/FullLibraryPage.xaml.cs +++ b/src/Portal/Sucrose.Portal/Views/Pages/Library/FullLibraryPage.xaml.cs @@ -33,23 +33,44 @@ private void Pagination() private async Task AddThemes(string Search, int Page) { - await Application.Current.Dispatcher.InvokeAsync(async () => + Dispose(); + + int Count = 0; + + PageScroll.ScrollToVerticalOffset(0); + + ThemePagination.Visibility = Visibility.Collapsed; + + foreach (string Theme in Themes) { - Dispose(); + if (string.IsNullOrEmpty(Search)) + { + if (SMMM.LibraryPagination * Page > Count && SMMM.LibraryPagination * Page <= Count + SMMM.LibraryPagination) + { + SPVCLC LibraryCard = new(Path.Combine(SMMM.LibraryLocation, Theme), SSTHI.ReadJson(Path.Combine(SMMM.LibraryLocation, Theme, SMR.SucroseInfo))); - int Count = 0; + LibraryCard.IsVisibleChanged += ThemeCard_IsVisibleChanged; - PageScroll.ScrollToVerticalOffset(0); + ThemeLibrary.Children.Add(LibraryCard); - ThemePagination.Visibility = Visibility.Collapsed; + Empty.Visibility = Visibility.Collapsed; - foreach (string Theme in Themes) + await Task.Delay(50); + } + + Count++; + } + else { - if (string.IsNullOrEmpty(Search)) + SSTHI Info = SSTHI.ReadJson(Path.Combine(SMMM.LibraryLocation, Theme, SMR.SucroseInfo)); + string Description = Info.Description.ToLowerInvariant(); + string Title = Info.Title.ToLowerInvariant(); + + if (Title.Contains(Search) || Description.Contains(Search)) { if (SMMM.LibraryPagination * Page > Count && SMMM.LibraryPagination * Page <= Count + SMMM.LibraryPagination) { - SPVCLC LibraryCard = new(Path.Combine(SMMM.LibraryLocation, Theme), SSTHI.ReadJson(Path.Combine(SMMM.LibraryLocation, Theme, SMR.SucroseInfo))); + SPVCLC LibraryCard = new(Path.Combine(SMMM.LibraryLocation, Theme), Info); LibraryCard.IsVisibleChanged += ThemeCard_IsVisibleChanged; @@ -62,39 +83,15 @@ await Application.Current.Dispatcher.InvokeAsync(async () => Count++; } - else - { - SSTHI Info = SSTHI.ReadJson(Path.Combine(SMMM.LibraryLocation, Theme, SMR.SucroseInfo)); - string Description = Info.Description.ToLowerInvariant(); - string Title = Info.Title.ToLowerInvariant(); - - if (Title.Contains(Search) || Description.Contains(Search)) - { - if (SMMM.LibraryPagination * Page > Count && SMMM.LibraryPagination * Page <= Count + SMMM.LibraryPagination) - { - SPVCLC LibraryCard = new(Path.Combine(SMMM.LibraryLocation, Theme), Info); - - LibraryCard.IsVisibleChanged += ThemeCard_IsVisibleChanged; - - ThemeLibrary.Children.Add(LibraryCard); - - Empty.Visibility = Visibility.Collapsed; - - await Task.Delay(50); - } - - Count++; - } - } } + } - if (ThemeLibrary.Children.Count <= 0) - { - Empty.Visibility = Visibility.Visible; - } + if (ThemeLibrary.Children.Count <= 0) + { + Empty.Visibility = Visibility.Visible; + } - ThemePagination.MaxPage = (int)Math.Ceiling((double)Count / SMMM.LibraryPagination); - }); + ThemePagination.MaxPage = (int)Math.Ceiling((double)Count / SMMM.LibraryPagination); } private async void FullLibraryPage_Loaded(object sender, RoutedEventArgs e) diff --git a/src/Shared/Sucrose.Shared.Space/Helper/Processor.cs b/src/Shared/Sucrose.Shared.Space/Helper/Processor.cs index 7c21d7d07..4a823f53d 100644 --- a/src/Shared/Sucrose.Shared.Space/Helper/Processor.cs +++ b/src/Shared/Sucrose.Shared.Space/Helper/Processor.cs @@ -160,6 +160,11 @@ public static bool Kill(params string[] Applications) private static string Parse(string Arguments) { + if (string.IsNullOrEmpty(Arguments)) + { + Arguments = string.Empty; + } + if (!Arguments.StartsWith("\"")) { Arguments = $"\"{Arguments}"; @@ -172,5 +177,10 @@ private static string Parse(string Arguments) return Arguments; } + + private static string Parse2(string Arguments) + { + return $"\"{Arguments.Trim('\"')}\""; + } } } \ No newline at end of file