mirror of
https://github.com/Crunchy-DL/Crunchy-Downloader.git
synced 2026-01-11 20:10:26 +00:00
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
44 lines
No EOL
1.3 KiB
C#
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;
|
|
}
|
|
} |