Skip to content

Commit

Permalink
Update Improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
Taiizor committed Oct 10, 2023
1 parent e183c6d commit 0c2b373
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/Bundle/Sucrose.Bundle/Main.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions src/Update/Sucrose.Update/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -416,5 +417,10 @@ private static void OnDownloadProgressChanged(object sender, DownloadProgressCha

UpdateLimit();
}

private static void OnChunkDownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{
UpdateLimit();
}
}
}

0 comments on commit 0c2b373

Please sign in to comment.