|
@@ -30,6 +30,7 @@ namespace PDF_Master.ViewModels.HomePanel.CloudDrive.CloudDriveType
|
|
|
/// <summary>
|
|
|
/// 预留需求:获取登录过的用户
|
|
|
/// </summary>
|
|
|
+ [Obsolete]
|
|
|
public async Task<bool> GetHistoryUsers()
|
|
|
{
|
|
|
var tuples = await GoogleDriveStatic.GetHistoryService();
|
|
@@ -50,7 +51,7 @@ namespace PDF_Master.ViewModels.HomePanel.CloudDrive.CloudDriveType
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- public async void AddGoogleDriveUser(Tuple<DriveService, UserCredential> tuple)
|
|
|
+ public void AddGoogleDriveUser(Tuple<DriveService, UserCredential> tuple)
|
|
|
{
|
|
|
GoogleDriveUserItem userItem = new GoogleDriveUserItem();
|
|
|
userItem.Service = tuple.Item1;
|
|
@@ -58,7 +59,7 @@ namespace PDF_Master.ViewModels.HomePanel.CloudDrive.CloudDriveType
|
|
|
userItem.cloudType = CloudType.GoogleDrive;
|
|
|
|
|
|
UserInfo user = new UserInfo();
|
|
|
- user = await userItem.GetUserAcountAsync();
|
|
|
+ user = userItem.GetUserAcountAsync();
|
|
|
userItem.userInfo = user;
|
|
|
|
|
|
Cloud.CloudLists.Add(userItem);
|
|
@@ -71,13 +72,13 @@ namespace PDF_Master.ViewModels.HomePanel.CloudDrive.CloudDriveType
|
|
|
if (tuple != null)
|
|
|
{
|
|
|
result = true;
|
|
|
- await GetUserInfo(tuple);//此处不可用异步处理,否则导致的结果是没法刷新集合呈现在UI上
|
|
|
+ GetUserInfo(tuple);//此处不可用异步处理,否则导致的结果是没法刷新集合呈现在UI上
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- public async Task<bool> GetUserInfo(Tuple<DriveService, UserCredential> tuple)
|
|
|
+ public bool GetUserInfo(Tuple<DriveService, UserCredential> tuple)
|
|
|
{
|
|
|
GoogleDriveUserItem userItem = new GoogleDriveUserItem();
|
|
|
userItem.Service = tuple.Item1;
|
|
@@ -85,7 +86,7 @@ namespace PDF_Master.ViewModels.HomePanel.CloudDrive.CloudDriveType
|
|
|
userItem.cloudType = CloudType.GoogleDrive;
|
|
|
|
|
|
UserInfo user = new UserInfo();
|
|
|
- user = await userItem.GetUserAcountAsync();
|
|
|
+ user = userItem.GetUserAcountAsync();
|
|
|
userItem.userInfo = user;
|
|
|
|
|
|
Cloud.CloudLists.Add(userItem);
|
|
@@ -106,43 +107,43 @@ namespace PDF_Master.ViewModels.HomePanel.CloudDrive.CloudDriveType
|
|
|
|
|
|
#region 文件
|
|
|
|
|
|
- public async Task<bool> UpLoadFile(FileOperation fileOperation)
|
|
|
+ public bool UpLoadFile(FileOperation fileOperation)
|
|
|
{
|
|
|
bool result = false;
|
|
|
var user = fileOperation.User as GoogleDriveUserItem;
|
|
|
if (user != null)
|
|
|
{
|
|
|
if (fileOperation.DoFile != null)
|
|
|
- result = await user.FileUpload(fileOperation.SourceFile, fileOperation.DoFile.Id);
|
|
|
+ result = user.FileUpload(fileOperation.SourceFile, fileOperation.DoFile.Id);
|
|
|
else
|
|
|
- result = await user.FileUpload(fileOperation.SourceFile,"");
|
|
|
+ result = user.FileUpload(fileOperation.SourceFile,"");
|
|
|
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- public async Task<string> DownloadGoogleFile(FileOperation fileOperation, string savePath)
|
|
|
+ public string DownloadGoogleFile(FileOperation fileOperation, string savePath)
|
|
|
{
|
|
|
string result = "";
|
|
|
var user = fileOperation.User as GoogleDriveUserItem;
|
|
|
if(user != null)
|
|
|
{
|
|
|
- result = await user.DownloadGoogleFile(fileOperation.DoFile as GoogleDriveFiles, savePath);
|
|
|
+ result = user.DownloadGoogleFile(fileOperation.DoFile as GoogleDriveFiles, savePath);
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- public async Task<List<GoogleDriveFiles>> GetFolder(FileOperation fileOperation)
|
|
|
+ public List<GoogleDriveFiles> GetFolder(FileOperation fileOperation)
|
|
|
{
|
|
|
var user = fileOperation.User as GoogleDriveUserItem;
|
|
|
if (user != null)
|
|
|
{
|
|
|
if (fileOperation.DoFile == null)
|
|
|
{
|
|
|
- return await user.GetDriveFiles(user.Service);
|
|
|
+ return user.GetDriveFiles(user.Service);
|
|
|
}
|
|
|
else
|
|
|
- return await user.GetDriveFiles(user.Service, (fileOperation.DoFile as GoogleDriveFiles).Id);
|
|
|
+ return user.GetDriveFiles(user.Service, (fileOperation.DoFile as GoogleDriveFiles).Id);
|
|
|
}
|
|
|
return null;
|
|
|
}
|