Crunchy-Downloader/CRD/ViewModels/Utils/ContentDialogUpdateViewModel.cs
Elwador 40b7b6d1de Add - Added **Clear Queue** button https://github.com/Crunchy-DL/Crunchy-Downloader/issues/206
Add - Added **Download Only First Available Dub** option https://github.com/Crunchy-DL/Crunchy-Downloader/issues/207
Add - Added **Mark as Watched** on Download Finish https://github.com/Crunchy-DL/Crunchy-Downloader/issues/216
Chg - Changed **copy state of settings** when an episode is added to the queue https://github.com/Crunchy-DL/Crunchy-Downloader/issues/211
Chg - Changed **updater error handling** https://github.com/Crunchy-DL/Crunchy-Downloader/issues/194
Fix - Fixed **updater on Linux** https://github.com/Crunchy-DL/Crunchy-Downloader/issues/194
Fix - Fixed **subtitle ordering** https://github.com/Crunchy-DL/Crunchy-Downloader/issues/213
Fix - Fixed **muxing passed settings** to apply configurations correctly
2025-02-16 04:16:06 +01:00

44 lines
No EOL
1.3 KiB
C#

using System;
using System.ComponentModel;
using CommunityToolkit.Mvvm.ComponentModel;
using CRD.Utils.Updater;
using FluentAvalonia.UI.Controls;
namespace CRD.ViewModels.Utils;
public partial class ContentDialogUpdateViewModel : ViewModelBase{
private readonly ContentDialog dialog;
[ObservableProperty]
private double _progress;
[ObservableProperty]
private bool _failed;
private AccountPageViewModel accountPageViewModel;
public ContentDialogUpdateViewModel(ContentDialog dialog){
if (dialog is null){
throw new ArgumentNullException(nameof(dialog));
}
this.dialog = dialog;
dialog.Closed += DialogOnClosed;
Updater.Instance.PropertyChanged += Progress_PropertyChanged;
}
private void Progress_PropertyChanged(object? sender, PropertyChangedEventArgs e){
if (e.PropertyName == nameof(Updater.Instance.progress)){
Progress = Updater.Instance.progress;
}else if (e.PropertyName == nameof(Updater.Instance.failed)){
Failed = Updater.Instance.failed;
dialog.IsPrimaryButtonEnabled = !Failed;
}
}
private void DialogOnClosed(ContentDialog sender, ContentDialogClosedEventArgs args){
dialog.Closed -= DialogOnClosed;
}
}