Skip to content

Commit

Permalink
Fix: Always cancel downloads when exiting the app
Browse files Browse the repository at this point in the history
  • Loading branch information
onionware-github committed Feb 17, 2023
1 parent 23f20b8 commit 487f15d
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace OnionMedia.Core.ViewModels
[ObservableObject]
public sealed partial class YouTubeDownloaderViewModel
{
public YouTubeDownloaderViewModel(IDialogService dialogService, IDownloaderDialogService downloaderDialogService, IDispatcherService dispatcher, INetworkStatusService networkStatusService, IToastNotificationService toastNotificationService, IPathProvider pathProvider, ITaskbarProgressService taskbarProgressService)
public YouTubeDownloaderViewModel(IDialogService dialogService, IDownloaderDialogService downloaderDialogService, IDispatcherService dispatcher, INetworkStatusService networkStatusService, IToastNotificationService toastNotificationService, IPathProvider pathProvider, ITaskbarProgressService taskbarProgressService, IWindowClosingService windowClosingService)
{
this.dialogService = dialogService ?? throw new ArgumentNullException(nameof(dialogService));
this.downloaderDialogService = downloaderDialogService ?? throw new ArgumentNullException(nameof(downloaderDialogService));
Expand All @@ -61,6 +61,7 @@ public YouTubeDownloaderViewModel(IDialogService dialogService, IDownloaderDialo
AddVideoCommand.PropertyChanged += (o, e) => UpdateProgressStateProperties();
AddSearchedVideo.PropertyChanged += (o, e) => UpdateProgressStateProperties();
Videos.CollectionChanged += (o, e) => UpdateProgressStateProperties();
windowClosingService.Closed += (o, e) => CancelAll();
networkAvailable = this.networkStatusService?.IsNetworkConnectionAvailable() ?? true;
if (this.networkStatusService != null)
this.networkStatusService.ConnectionStateChanged += (o, e) => this.dispatcher.Enqueue(() => NetworkAvailable = e);
Expand Down

0 comments on commit 487f15d

Please sign in to comment.