CreateWorkViewModel.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using CommunityToolkit.Mvvm.ComponentModel;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows.Data;
  8. using WechatBakTool.Model;
  9. using WechatBakTool.Pages;
  10. namespace WechatBakTool.ViewModel
  11. {
  12. public partial class CreateWorkViewModel : ObservableObject
  13. {
  14. [ObservableProperty]
  15. private List<ProcessInfo> processInfos = new List<ProcessInfo>();
  16. [ObservableProperty]
  17. private ProcessInfo? selectProcess;
  18. [ObservableProperty]
  19. private string userName = "";
  20. [ObservableProperty]
  21. private int keyType = -1;
  22. [ObservableProperty]
  23. private bool isEnable = true;
  24. private string labelStatus = "-";
  25. public string LabelStatus
  26. {
  27. get { return "状态:" + labelStatus; }
  28. set
  29. {
  30. labelStatus = value;
  31. OnPropertyChanged("LabelStatus");
  32. }
  33. }
  34. }
  35. public class GetKeyConverter : IValueConverter
  36. {
  37. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  38. {
  39. return (int.Parse(parameter.ToString()!) == (int)value);
  40. }
  41. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  42. {
  43. return (bool)value ? parameter : Binding.DoNothing;
  44. }
  45. }
  46. }