Crunchy-Downloader/CRD/ViewModels/Utils/ContentDialogUpdateViewModel.cs
Elwador 6aa10cb2c2 Add - Added a button to manually match Sonarr series
Add - Available dubs/subs overall to history series - not all dubs/subs are available for every season/episode
Fix - Subscription end date was in UTC, causing the program to not recognize an active premium subscription  https://github.com/Crunchy-DL/Crunchy-Downloader/issues/74
2024-08-15 02:27:49 +02:00

38 lines
No EOL
1.1 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;
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;
}
}
private void DialogOnClosed(ContentDialog sender, ContentDialogClosedEventArgs args){
dialog.Closed -= DialogOnClosed;
}
}