Refactor and enhance DownloadManager application
Refactored and enhanced the DownloadManager application with significant updates across multiple files. Key changes include: - **App.xaml.cs**: Re-added necessary imports, updated service registrations, and made `OnStartup` asynchronous. - **DownloadManager.csproj**: Updated target framework, application icon, and added assembly version. - **DownloadManager.sln**: Updated project format and added configurations for multiple platforms. - **DownloadManagerService.cs**: Added `HistoryStorageService` dependency, introduced `Initial` method, and improved task management. - **DownloadWorker.cs**: Enhanced error handling and changed `StartDownloadAsync` to `StartDownload`. - **ViewModels**: Refactored to use dependency injection, updated task initialization, and added new commands for settings management. - **UI Updates**: Improved `DownloadingPage.xaml` and `WaitingPage.xaml` with `ListView` and added headers. Restructured `SettingsPage.xaml` for better organization and added new settings options. - **MainWindow**: Enhanced navigation and applied user-defined themes and backdrops. - **New Files**: Added `HistoryStorageService.cs`, `ThemeToIndexConverter.cs`, `CompletedItemData.cs`, `Settings.Designer.cs`, `Settings.settings`, `Constants.cs`, `CompletedPageViewModel.cs`, `CompletedPage.xaml`, and `CompletedPage.xaml.cs` to support new features and improvements. These changes aim to improve the application's robustness, maintainability, and user experience.
This commit is contained in:
@@ -5,18 +5,19 @@ using Wpf.Ui.Controls;
|
||||
|
||||
namespace DownloadManager.ViewModels.Pages;
|
||||
|
||||
public partial class WaitingPageViewModel : ObservableObject, INavigationAware
|
||||
public partial class WaitingPageViewModel(DownloadManagerService downloadManager) : ObservableObject, INavigationAware
|
||||
{
|
||||
[ObservableProperty]
|
||||
private ObservableCollection<DownloadItemData>? waitingTask;
|
||||
|
||||
public void OnNavigatedFrom()
|
||||
{
|
||||
downloadManager.OnQueuedItemChanged -= DownloadService_OnQueuedItemChanged;
|
||||
}
|
||||
|
||||
public void OnNavigatedTo()
|
||||
{
|
||||
App.GetService<DownloadManagerService>().OnQueuedItemChanged += DownloadService_OnQueuedItemChanged;
|
||||
downloadManager.OnQueuedItemChanged += DownloadService_OnQueuedItemChanged;
|
||||
|
||||
LoadTasks();
|
||||
}
|
||||
@@ -28,6 +29,6 @@ public partial class WaitingPageViewModel : ObservableObject, INavigationAware
|
||||
|
||||
private void LoadTasks()
|
||||
{
|
||||
WaitingTask = new (App.GetService<DownloadManagerService>().GetWaitingTask());
|
||||
WaitingTask = new(downloadManager.GetWaitingTask());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user