2
0

CreateWorkViewModel.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. namespace WechatBakTool.ViewModel
  10. {
  11. partial class CreateWorkViewModel : ObservableObject
  12. {
  13. [ObservableProperty]
  14. private List<ProcessInfo> processInfos = new List<ProcessInfo>();
  15. [ObservableProperty]
  16. private ProcessInfo? selectProcess;
  17. [ObservableProperty]
  18. private string userName = "";
  19. [ObservableProperty]
  20. private int keyType = -1;
  21. }
  22. public class GetKeyConverter : IValueConverter
  23. {
  24. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  25. {
  26. return (int.Parse(parameter.ToString()!) == (int)value);
  27. }
  28. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  29. {
  30. return (bool)value ? parameter : Binding.DoNothing;
  31. }
  32. }
  33. }