CloudDriveContentViewModel.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using PDF_Master.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_Master.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. bool result = false;
  30. result = await Manager.LoginUser(cloudDriveItem.CloudDiskType);
  31. IshowContentHandler?.Invoke(null, !result);
  32. }
  33. public async void CheckDriveLoginUser(CloudBoxItem cloudDriveItem)
  34. {
  35. bool result = false;
  36. result = await Manager.LoginUser(cloudDriveItem.CloudDiskType);
  37. }
  38. }
  39. }