Files
NebulaLauncher/Nebula.Launcher/ViewModels/Popup/LoadingContextViewModel.cs

59 lines
1.4 KiB
C#
Raw Normal View History

2025-01-08 18:00:06 +03:00
using CommunityToolkit.Mvvm.ComponentModel;
2025-06-23 16:39:30 +03:00
using Nebula.Launcher.Services;
2025-01-08 18:00:06 +03:00
using Nebula.Launcher.Views.Popup;
using Nebula.Shared.Models;
2025-01-14 22:10:16 +03:00
using Nebula.Shared.Services;
2025-01-08 18:00:06 +03:00
2025-01-14 22:10:16 +03:00
namespace Nebula.Launcher.ViewModels.Popup;
2025-01-08 18:00:06 +03:00
[ViewModelRegister(typeof(LoadingContextView), false)]
2025-01-14 22:10:16 +03:00
[ConstructGenerator]
2025-01-08 18:00:06 +03:00
public sealed partial class LoadingContextViewModel : PopupViewModelBase, ILoadingHandler
{
2025-01-14 22:10:16 +03:00
[GenerateProperty] public override PopupMessageService PopupMessageService { get; }
2025-03-12 14:51:47 +03:00
[GenerateProperty] public CancellationService CancellationService { get; }
2025-01-08 18:00:06 +03:00
2025-01-14 22:10:16 +03:00
[ObservableProperty] private int _currJobs;
[ObservableProperty] private int _resolvedJobs;
2025-06-23 16:39:30 +03:00
public string LoadingName { get; set; } = LocalisationService.GetString("popup-loading");
2025-03-14 18:32:03 +03:00
public bool IsCancellable { get; set; } = true;
2025-01-12 15:15:01 +03:00
public override bool IsClosable => false;
2025-01-08 18:00:06 +03:00
public override string Title => LoadingName;
2025-01-14 22:10:16 +03:00
2025-01-08 18:00:06 +03:00
public void SetJobsCount(int count)
{
CurrJobs = count;
}
public int GetJobsCount()
{
return CurrJobs;
}
public void SetResolvedJobsCount(int count)
{
ResolvedJobs = count;
}
public int GetResolvedJobsCount()
{
return ResolvedJobs;
}
2025-01-14 22:10:16 +03:00
2025-03-12 14:51:47 +03:00
public void Cancel(){
2025-03-14 18:32:03 +03:00
if(!IsCancellable) return;
2025-03-12 14:51:47 +03:00
CancellationService.Cancel();
Dispose();
}
2025-01-14 22:10:16 +03:00
protected override void Initialise()
{
}
protected override void InitialiseInDesignMode()
{
}
2025-01-08 18:00:06 +03:00
}