Tasks are broken down into major and minor tasks. Major tasks are like install game, redistributable, or tool. These are reported as individual tasks in the download queue. Minor tasks are running of a script, downloading saves, extracting/downloading, etc.
59 lines
1.5 KiB
C#
59 lines
1.5 KiB
C#
using System;
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
using LANCommander.SDK.Enums;
|
|
using LANCommander.SDK.Models;
|
|
|
|
namespace LANCommander.Launcher.Avalonia.ViewModels;
|
|
|
|
public partial class InstallTaskItemViewModel : ViewModelBase
|
|
{
|
|
[ObservableProperty]
|
|
private Guid _id;
|
|
|
|
[ObservableProperty]
|
|
private string _title = string.Empty;
|
|
|
|
[ObservableProperty]
|
|
private InstallTaskType _type;
|
|
|
|
[ObservableProperty]
|
|
private InstallTaskStatus _status = InstallTaskStatus.Queued;
|
|
|
|
[ObservableProperty]
|
|
private float _progress;
|
|
|
|
[ObservableProperty]
|
|
private bool _reportsProgress;
|
|
|
|
[ObservableProperty]
|
|
private bool _isCritical;
|
|
|
|
[ObservableProperty]
|
|
private string? _errorMessage;
|
|
|
|
[ObservableProperty]
|
|
private long _bytesTransferred;
|
|
|
|
[ObservableProperty]
|
|
private long _totalBytes;
|
|
|
|
[ObservableProperty]
|
|
private long _transferSpeed;
|
|
|
|
public bool IsCompleted => Status == InstallTaskStatus.Completed;
|
|
public bool IsRunning => Status == InstallTaskStatus.Running;
|
|
public bool IsFailed => Status == InstallTaskStatus.Failed;
|
|
public bool IsQueued => Status == InstallTaskStatus.Queued;
|
|
public bool IsSkipped => Status == InstallTaskStatus.Skipped;
|
|
|
|
public InstallTaskItemViewModel() { }
|
|
|
|
public InstallTaskItemViewModel(InstallTaskDefinition taskDef)
|
|
{
|
|
Id = taskDef.Id;
|
|
Title = taskDef.Title;
|
|
Type = taskDef.Type;
|
|
ReportsProgress = taskDef.ReportsProgress;
|
|
IsCritical = taskDef.IsCritical;
|
|
}
|
|
}
|