CloudDriveManager.cs 2.1 KB

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