CloudDriveContentViewModel.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using PDF_Office.Model.CloudDrive;
  2. using Prism.Commands;
  3. using Prism.Mvvm;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace PDF_Office.ViewModels.HomePanel.CloudDrive
  10. {
  11. public class CloudDriveContentViewModel : BindableBase
  12. {
  13. public DelegateCommand<CloudBoxItem> CheckDriveCommand { get; set; }
  14. public DelegateCommand<CloudBoxItem> CheckDriveLoginUserCommand { get; set; }
  15. private CloudDriveManager Manager =>CloudDriveManager.CloudManager;
  16. public event EventHandler<bool> IshowContentHandler;
  17. public CloudDriveContentViewModel()
  18. {
  19. CheckDriveCommand = new DelegateCommand<CloudBoxItem>(CheckDrive);
  20. CheckDriveLoginUserCommand = new DelegateCommand<CloudBoxItem>(CheckDriveLoginUser);
  21. }
  22. public void LoadUsers()
  23. {
  24. var result = Manager.LoadedUsers();
  25. IshowContentHandler?.Invoke(null, !result);
  26. }
  27. public async void CheckDrive(CloudBoxItem cloudDriveItem)
  28. {
  29. //IshowContentHandler?.Invoke(null, false);
  30. //return;
  31. bool result = false;
  32. result = await Manager.LoginUser(cloudDriveItem.CloudDiskType);
  33. IshowContentHandler?.Invoke(null, !result);
  34. }
  35. public async void CheckDriveLoginUser(CloudBoxItem cloudDriveItem)
  36. {
  37. bool result = false;
  38. result = await Manager.LoginUser(cloudDriveItem.CloudDiskType);
  39. }
  40. }
  41. }