Hopefully fix #492

This commit is contained in:
Michael Bucari-Tovo 2023-02-14 23:07:40 -07:00
parent dc7c03661d
commit c1de0e60d2

View File

@ -44,11 +44,11 @@ namespace LibationAvalonia.ViewModels
private bool _progressBarVisible; private bool _progressBarVisible;
private decimal _speedLimit; private decimal _speedLimit;
public int CompletedCount { get => _completedCount; private set { this.RaiseAndSetIfChanged(ref _completedCount, value); this.RaisePropertyChanged(nameof(AnyCompleted)); } } public int CompletedCount { get => _completedCount; private set => Dispatcher.UIThread.Post(() => { this.RaiseAndSetIfChanged(ref _completedCount, value); this.RaisePropertyChanged(nameof(AnyCompleted)); }); }
public int QueuedCount { get => _queuedCount; private set { this.RaiseAndSetIfChanged(ref _queuedCount, value); this.RaisePropertyChanged(nameof(AnyQueued)); } } public int QueuedCount { get => _queuedCount; private set => Dispatcher.UIThread.Post(() => { this.RaiseAndSetIfChanged(ref _queuedCount, value); this.RaisePropertyChanged(nameof(AnyQueued)); }); }
public int ErrorCount { get => _errorCount; private set { this.RaiseAndSetIfChanged(ref _errorCount, value); this.RaisePropertyChanged(nameof(AnyErrors)); } } public int ErrorCount { get => _errorCount; private set => Dispatcher.UIThread.Post(() => { this.RaiseAndSetIfChanged(ref _errorCount, value); this.RaisePropertyChanged(nameof(AnyErrors)); }); }
public string RunningTime { get => _runningTime; set { this.RaiseAndSetIfChanged(ref _runningTime, value); } } public string RunningTime { get => _runningTime; set => Dispatcher.UIThread.Post(() => { this.RaiseAndSetIfChanged(ref _runningTime, value); }); }
public bool ProgressBarVisible { get => _progressBarVisible; set { this.RaiseAndSetIfChanged(ref _progressBarVisible, value); } } public bool ProgressBarVisible { get => _progressBarVisible; set => Dispatcher.UIThread.Post(() => { this.RaiseAndSetIfChanged(ref _progressBarVisible, value); }); }
public bool AnyCompleted => CompletedCount > 0; public bool AnyCompleted => CompletedCount > 0;
public bool AnyQueued => QueuedCount > 0; public bool AnyQueued => QueuedCount > 0;
public bool AnyErrors => ErrorCount > 0; public bool AnyErrors => ErrorCount > 0;
@ -78,8 +78,11 @@ namespace LibationAvalonia.ViewModels
: _speedLimit > 1 ? 0.1m : _speedLimit > 1 ? 0.1m
: 0.01m; : 0.01m;
Dispatcher.UIThread.Post(() =>
{
this.RaisePropertyChanged(nameof(SpeedLimitIncrement)); this.RaisePropertyChanged(nameof(SpeedLimitIncrement));
this.RaisePropertyChanged(); this.RaisePropertyChanged();
});
} }
} }
@ -92,12 +95,12 @@ namespace LibationAvalonia.ViewModels
ErrorCount = errCount; ErrorCount = errCount;
CompletedCount = completeCount; CompletedCount = completeCount;
this.RaisePropertyChanged(nameof(Progress)); Dispatcher.UIThread.Post(() => this.RaisePropertyChanged(nameof(Progress)));
} }
private void Queue_QueuededCountChanged(object sender, int cueCount) private void Queue_QueuededCountChanged(object sender, int cueCount)
{ {
QueuedCount = cueCount; QueuedCount = cueCount;
this.RaisePropertyChanged(nameof(Progress)); Dispatcher.UIThread.Post(() => this.RaisePropertyChanged(nameof(Progress)));
} }
public void WriteLine(string text) public void WriteLine(string text)