CloudDriveManager.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. using PDF_Office.Model.CloudDrive;
  2. using PDF_Office.ViewModels.HomePanel.CloudDrive.CloudDriveType;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Collections.ObjectModel;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace PDF_Office.ViewModels.HomePanel.CloudDrive
  10. {
  11. //各云盘的管理类
  12. //单实例化
  13. public class CloudDriveManager
  14. {
  15. public GoogleDriveManager GoogleDrive => GoogleDriveManager.GoogleDrive;
  16. public DropbBoxManager DropbBox => DropbBoxManager.DropbBox;
  17. public CloudType cloudType;
  18. private static CloudDriveManager instance;
  19. public static CloudDriveManager GetInstance()
  20. {
  21. if (instance == null)
  22. instance = new CloudDriveManager();
  23. return instance;
  24. }
  25. private CloudDriveManager()
  26. {
  27. }
  28. #region 用户帐号
  29. /// <summary>
  30. /// 登录
  31. /// </summary>
  32. public async Task<bool> LoginUser(CloudType cloudType)
  33. {
  34. switch(cloudType)
  35. {
  36. case CloudType.GoogleDrive:
  37. return await GoogleDrive.LoginUserCount();
  38. case CloudType.DropBox:
  39. return await DropbBox.LoginUser();
  40. }
  41. return false;
  42. }
  43. public bool LoadedUsers()
  44. {
  45. bool isUsers = false;
  46. if (Cloud.CloudLists.Count > 0)
  47. isUsers = true;
  48. return isUsers;
  49. }
  50. /// <summary>
  51. /// 移除用户
  52. /// </summary>
  53. public async Task<bool> RemoveUser()
  54. {
  55. GoogleDriveUserItem userIttem = null;
  56. switch (cloudType)
  57. {
  58. case CloudType.OneDrive:
  59. return await GoogleDrive.RemoveUser(userIttem);
  60. }
  61. return false;
  62. }
  63. /// <summary>
  64. /// 切换用户
  65. /// </summary>
  66. public void SwitchUser()
  67. {
  68. }
  69. #endregion
  70. #region 文件
  71. public void GetFiles()
  72. {
  73. }
  74. public void GetFolders()
  75. {
  76. }
  77. public void UpLoad()
  78. {
  79. }
  80. #endregion
  81. }
  82. }