mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-05-23 09:55:48 +08:00
42 lines
1.1 KiB
C#
42 lines
1.1 KiB
C#
using System;
|
|
using System.Threading.Tasks;
|
|
using BetterGenshinImpact.ViewModel.Pages.OneDragon;
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
using System.Windows.Media;
|
|
|
|
namespace BetterGenshinImpact.Model;
|
|
|
|
public partial class OneDragonTaskItem : ObservableObject
|
|
{
|
|
[ObservableProperty]
|
|
private string? _name;
|
|
|
|
[ObservableProperty]
|
|
private Brush _statusColor = Brushes.Gray;
|
|
|
|
[ObservableProperty]
|
|
private bool _isEnabled = true;
|
|
|
|
[ObservableProperty]
|
|
private OneDragonBaseViewModel? _viewModel;
|
|
|
|
public Func<Task> Action { get; private set; }
|
|
|
|
public OneDragonTaskItem(string name, Func<Task> action)
|
|
{
|
|
Name = name;
|
|
Action = action;
|
|
}
|
|
|
|
// public OneDragonTaskItem(Type viewModelType, Func<Task> action)
|
|
// {
|
|
// ViewModel = App.GetService(viewModelType) as OneDragonBaseViewModel;
|
|
// if (ViewModel == null)
|
|
// {
|
|
// throw new ArgumentException("Invalid view model type", nameof(viewModelType));
|
|
// }
|
|
// Name = ViewModel.Title;
|
|
// Action = action;
|
|
// }
|
|
}
|