65 lines
1.8 KiB
C#
65 lines
1.8 KiB
C#
// ProgressWindowViewModel.cs
|
|
using System.ComponentModel;
|
|
using System.Reactive;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using ReactiveUI;
|
|
namespace AvaloniaApplication2.ViewModels
|
|
{
|
|
|
|
public class ProgressWindowViewModel : ViewModelBase
|
|
{
|
|
//private int _progressValue;
|
|
//public int ProgressValue
|
|
//{
|
|
// get => _progressValue;
|
|
// set => this.RaiseAndSetIfChanged(ref _progressValue, value);
|
|
//}
|
|
|
|
//private bool _isIndeterminate = true;
|
|
//public bool IsIndeterminate
|
|
//{
|
|
// get => _isIndeterminate;
|
|
// set => this.RaiseAndSetIfChanged(ref _isIndeterminate, value);
|
|
//}
|
|
|
|
//public ReactiveCommand<Unit, Unit> CancelCommand { get; }
|
|
|
|
//public ProgressWindowViewModel()
|
|
//{
|
|
// CancelCommand = ReactiveCommand.Create(() => { /* 取消操作 */ });
|
|
//}
|
|
|
|
//// 模拟更新过程
|
|
//public async Task StartUpdate()
|
|
//{
|
|
// IsIndeterminate = false;
|
|
// for (int i = 0; i <= 100; i++)
|
|
// {
|
|
// ProgressValue = i;
|
|
// await Task.Delay(5); // 模拟工作
|
|
// }
|
|
//}
|
|
|
|
private int _progress;
|
|
public int Progress
|
|
{
|
|
get => _progress;
|
|
set => this.RaiseAndSetIfChanged(ref _progress, value);
|
|
}
|
|
|
|
private string _progressText = "准备上传...";
|
|
public string ProgressText
|
|
{
|
|
get => _progressText;
|
|
set => this.RaiseAndSetIfChanged(ref _progressText, value);
|
|
}
|
|
|
|
public ReactiveCommand<Unit, Unit> CancelCommand { get; }
|
|
|
|
public ProgressWindowViewModel()
|
|
{
|
|
CancelCommand = ReactiveCommand.Create(() => { /* 取消逻辑 */ });
|
|
}
|
|
}
|
|
} |