diff --git a/yy-admin-master/YY.Admin/ViewModels/MixerMaterial/MixerMaterialListViewModel.cs b/yy-admin-master/YY.Admin/ViewModels/MixerMaterial/MixerMaterialListViewModel.cs index fc400fd..00530a3 100644 --- a/yy-admin-master/YY.Admin/ViewModels/MixerMaterial/MixerMaterialListViewModel.cs +++ b/yy-admin-master/YY.Admin/ViewModels/MixerMaterial/MixerMaterialListViewModel.cs @@ -84,9 +84,13 @@ public class MixerMaterialListViewModel : BaseViewModel public string ToggleExpandButtonText => _isTreeAllExpanded ? "折叠全部" : "展开全部"; + private bool _isSyncing; + public bool IsSyncing { get => _isSyncing; set => SetProperty(ref _isSyncing, value); } + public DelegateCommand SearchCommand { get; } public DelegateCommand ResetCommand { get; } public DelegateCommand AddCommand { get; } + public DelegateCommand PullAllCommand { get; } public DelegateCommand EditCommand { get; } public DelegateCommand DeleteCommand { get; } public DelegateCommand PrevPageCommand { get; } @@ -120,6 +124,25 @@ public class MixerMaterialListViewModel : BaseViewModel PrevPageCommand = new DelegateCommand(async () => { if (PageNo > 1) { PageNo--; await LoadAsync(); } }); NextPageCommand = new DelegateCommand(async () => { if ((long)PageNo * PageSize < Total) { PageNo++; await LoadAsync(); } }); ToggleExpandCommand = new DelegateCommand(ToggleExpand); + PullAllCommand = new DelegateCommand(async () => + { + if (IsSyncing) return; + IsSyncing = true; + try + { + await _mixerMaterialService.SyncFromRemoteAsync(); + await LoadAsync(); + Growl.Success("全量拉取完成!"); + } + catch (Exception ex) + { + Growl.Error($"全量拉取失败:{ex.Message}"); + } + finally + { + IsSyncing = false; + } + }); _materialChangedToken = _eventAggregator .GetEvent() diff --git a/yy-admin-master/YY.Admin/Views/MixerMaterial/MixerMaterialListView.xaml b/yy-admin-master/YY.Admin/Views/MixerMaterial/MixerMaterialListView.xaml index bbdcdbe..02b3edb 100644 --- a/yy-admin-master/YY.Admin/Views/MixerMaterial/MixerMaterialListView.xaml +++ b/yy-admin-master/YY.Admin/Views/MixerMaterial/MixerMaterialListView.xaml @@ -93,6 +93,13 @@ +