From 0c2b37358c72eeab95fce4d2a44a61938eac205a Mon Sep 17 00:00:00 2001 From: Taiizor <41683699+Taiizor@users.noreply.github.com> Date: Tue, 10 Oct 2023 18:17:19 +0300 Subject: [PATCH] Update Improvement --- src/Bundle/Sucrose.Bundle/Main.xaml.cs | 6 ++---- .../Pages/Setting/OtherSettingViewModel.cs | 17 ++++++++++++++++- src/Update/Sucrose.Update/App.xaml.cs | 6 ++++++ 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/Bundle/Sucrose.Bundle/Main.xaml.cs b/src/Bundle/Sucrose.Bundle/Main.xaml.cs index 0cf37d548..5c9000cac 100644 --- a/src/Bundle/Sucrose.Bundle/Main.xaml.cs +++ b/src/Bundle/Sucrose.Bundle/Main.xaml.cs @@ -114,8 +114,8 @@ private static async Task InstallRedist() FileName = Executable, CreateNoWindow = true, UseShellExecute = false, - RedirectStandardError = true, - RedirectStandardOutput = true + RedirectStandardError = false, + RedirectStandardOutput = false }; using (Process Installer = new()) @@ -197,8 +197,6 @@ private static async Task ControlDirectoryStable(string Location) } await Task.Delay(MinDelay); - - await Task.CompletedTask; } private static async Task ExtractResources(string SourcePath, string ExtractPath) diff --git a/src/Portal/Sucrose.Portal/ViewModels/Pages/Setting/OtherSettingViewModel.cs b/src/Portal/Sucrose.Portal/ViewModels/Pages/Setting/OtherSettingViewModel.cs index 1334fc46e..6fc7a5bc1 100644 --- a/src/Portal/Sucrose.Portal/ViewModels/Pages/Setting/OtherSettingViewModel.cs +++ b/src/Portal/Sucrose.Portal/ViewModels/Pages/Setting/OtherSettingViewModel.cs @@ -284,7 +284,22 @@ private void InitializeViewModel() foreach (SEST Type in Enum.GetValues(typeof(SEST))) { - UpdateLimitType.Items.Add(Type); + if (Type >= SEST.Megabyte) + { + UpdateLimitType.Items.Add(new ComboBoxItem() + { + IsEnabled = true, + Content = Type + }); + } + else + { + UpdateLimitType.Items.Add(new ComboBoxItem() + { + IsEnabled = false, + Content = Type + }); + } } UpdateLimitType.SelectedIndex = (int)SMMM.DownloadType; diff --git a/src/Update/Sucrose.Update/App.xaml.cs b/src/Update/Sucrose.Update/App.xaml.cs index d6b4f69ea..496f69ef7 100644 --- a/src/Update/Sucrose.Update/App.xaml.cs +++ b/src/Update/Sucrose.Update/App.xaml.cs @@ -262,6 +262,7 @@ protected async void Configure() SUMI.DownloadService.DownloadStarted += OnDownloadStarted; SUMI.DownloadService.DownloadFileCompleted += OnDownloadFileCompleted; SUMI.DownloadService.DownloadProgressChanged += OnDownloadProgressChanged; + SUMI.DownloadService.ChunkDownloadProgressChanged += OnChunkDownloadProgressChanged; await SUMI.DownloadService.DownloadFileTaskAsync(SUMI.Source, Bundle); @@ -416,5 +417,10 @@ private static void OnDownloadProgressChanged(object sender, DownloadProgressCha UpdateLimit(); } + + private static void OnChunkDownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e) + { + UpdateLimit(); + } } } \ No newline at end of file