WorkspaceViewModel.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. using CommunityToolkit.Mvvm.ComponentModel;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Collections.ObjectModel;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using WechatBakTool.Model;
  9. namespace WechatBakTool.ViewModel
  10. {
  11. partial class WorkspaceViewModel : ObservableObject
  12. {
  13. private WXContact? wXContact = null;
  14. public WXContact? WXContact {
  15. get { return wXContact; }
  16. set {
  17. wXContact = value;
  18. OnPropertyChanged("WXContact");
  19. OnPropertyChanged("SelectContact");
  20. }
  21. }
  22. public bool SelectContact
  23. {
  24. get
  25. {
  26. if (WXContact == null)
  27. return false;
  28. else
  29. return true;
  30. }
  31. }
  32. [ObservableProperty]
  33. private ObservableCollection<WXContact>? contacts;
  34. [ObservableProperty]
  35. private ObservableCollection<ExportItem>? exportItems;
  36. [ObservableProperty]
  37. private ExportItem? selectExportItem;
  38. private string searchString = "";
  39. public string SearchString
  40. {
  41. set
  42. {
  43. if (value == "搜索...")
  44. searchString = "";
  45. else
  46. searchString = value;
  47. OnPropertyChanged("SearchString");
  48. }
  49. get
  50. {
  51. if (searchString == "")
  52. return "搜索...";
  53. return searchString;
  54. }
  55. }
  56. public string SearchRealString
  57. {
  58. get
  59. {
  60. return searchString;
  61. }
  62. }
  63. }
  64. }