f0346fd4c8
Chg: Show additional info for downloads (slected dubs and subs) Chg: When pressing update it now shows the progress Chg: Changed how the error window looks Chg: Additional checks for premium episodes to make sure it is possible the logged in user can download the episode
40 lines
1.1 KiB
C#
40 lines
1.1 KiB
C#
using System;
|
|
using System.ComponentModel;
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
using CRD.Downloader;
|
|
using CRD.Utils.Structs;
|
|
using CRD.Utils.Updater;
|
|
using FluentAvalonia.UI.Controls;
|
|
|
|
namespace CRD.ViewModels;
|
|
|
|
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;
|
|
}
|
|
} |