WorkspaceViewModel.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. public 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. [ObservableProperty]
  23. public string exportCount = "";
  24. public bool SelectContact
  25. {
  26. get
  27. {
  28. if (WXContact == null)
  29. return false;
  30. else
  31. return true;
  32. }
  33. }
  34. [ObservableProperty]
  35. private ObservableCollection<WXContact>? contacts;
  36. [ObservableProperty]
  37. private ObservableCollection<ExportItem>? exportItems;
  38. [ObservableProperty]
  39. private ExportItem? selectExportItem;
  40. private string searchString = "";
  41. public string SearchString
  42. {
  43. set
  44. {
  45. if (value == "搜索...")
  46. searchString = "";
  47. else
  48. searchString = value;
  49. OnPropertyChanged("SearchString");
  50. }
  51. get
  52. {
  53. if (searchString == "")
  54. return "搜索...";
  55. return searchString;
  56. }
  57. }
  58. public string SearchRealString
  59. {
  60. get
  61. {
  62. return searchString;
  63. }
  64. }
  65. }
  66. }