Browse Source

Merge branch 'dev' into practice2

OYXH\oyxh 2 years ago
parent
commit
f727ae84a2

+ 17 - 3
PDF Office/Model/CloudDrive/CloudFiles.cs

@@ -13,17 +13,29 @@ namespace PDF_Office.Model.CloudDrive
     {
     }
 
-    public class GoogleDriveUser
+    #region GooglrDrive
+
+    public class CloudFileUser
+    {
+        public User user { get; set; }
+        public UserBaseItem driveItem{ get; set; }
+    }
+
+    public class User
     {
+        public CloudType cloudType { get; set; }
         public string Name { get; set; }
         public int Id { get; set; }
 
         public string UserAccount { get; set; }
+    }
 
-        public UserCredential CurrentCredential { get; set; }
-        public GoogleDriveFiles DriveFiles { get; set; }
+    public class UserBaseItem
+    {
+      
     }
 
+
     //谷歌云盘的文件
     public class GoogleDriveFiles
     {
@@ -34,4 +46,6 @@ namespace PDF_Office.Model.CloudDrive
         public DateTime? CreatedTime { get; set; }
     }
 
+    #endregion
+
 }

+ 5 - 4
PDF Office/PDF Office.csproj

@@ -247,11 +247,12 @@
     <Compile Include="ViewModels\Dialog\ToolsDialogs\SaftyDialogs\SetPasswordDialogViewModel.cs" />
     <Compile Include="ViewModels\Dialog\VerifyPassWordDialogViewModel.cs" />
     <Compile Include="ViewModels\HomePanel\CloudDrive\CloudDriveContentViewModel.cs" />
+    <Compile Include="ViewModels\HomePanel\CloudDrive\CloudDriveManager.cs" />
     <Compile Include="ViewModels\HomePanel\CloudDrive\CloudFilesContentViewModel.cs" />
-    <Compile Include="ViewModels\HomePanel\CloudDrive\DropbBoxManager.cs" />
-    <Compile Include="ViewModels\HomePanel\CloudDrive\DropbBoxUserItem.cs" />
-    <Compile Include="ViewModels\HomePanel\CloudDrive\GoogleDriveManager.cs" />
-    <Compile Include="ViewModels\HomePanel\CloudDrive\GoogleDriveUserItem.cs" />
+    <Compile Include="ViewModels\HomePanel\CloudDrive\CloudDriveType\DropbBoxManager.cs" />
+    <Compile Include="ViewModels\HomePanel\CloudDrive\CloudDriveType\DropbBoxUserItem.cs" />
+    <Compile Include="ViewModels\HomePanel\CloudDrive\CloudDriveType\GoogleDriveManager.cs" />
+    <Compile Include="ViewModels\HomePanel\CloudDrive\CloudDriveType\GoogleDriveUserItem.cs" />
     <Compile Include="ViewModels\HomePanel\HomeCloudContentViewModel.cs" />
     <Compile Include="ViewModels\HomePanel\HomeGuidContentViewModel.cs" />
     <Compile Include="ViewModels\HomePanel\HomeToolsContentViewModel.cs" />

+ 41 - 10
PDF Office/ViewModels/HomePanel/CloudDrive/CloudDriveContentViewModel.cs

@@ -1,4 +1,5 @@
-using Prism.Commands;
+using PDF_Office.Model.CloudDrive;
+using Prism.Commands;
 using Prism.Mvvm;
 using System;
 using System.Collections.Generic;
@@ -10,23 +11,53 @@ namespace PDF_Office.ViewModels.HomePanel.CloudDrive
 {
     public class CloudDriveContentViewModel : BindableBase
     {
-      
-      
 
-     ///   public DelegateCommand CheckDriveCommand { get; set; }
-       // public DelegateCommand OpenCloudDriveCommand { get; set; }
+
+        public DelegateCommand<CloudDriveItem> CheckDriveCommand { get; set; }
+        public DelegateCommand<CloudDriveItem> CheckDriveLoginUserCommand { get; set; }
+
+        private CloudDriveManager Manager =>CloudDriveManager.GetInstance();
+        public event EventHandler<bool> IshowContentHandler;
+      
         public CloudDriveContentViewModel()
         {
-           
-           // CheckDriveCommand = new DelegateCommand(CheckDrive);
+            CheckDriveCommand = new DelegateCommand<CloudDriveItem>(CheckDrive);
+            CheckDriveLoginUserCommand = new DelegateCommand<CloudDriveItem>(CheckDriveLoginUser);
+          
+        }
+
+        public void LoadUsers()
+        {
+            var result = Manager.LoadedUsers();
 
+            IshowContentHandler?.Invoke(null, !result);
+        }
 
+        public async void CheckDrive(CloudDriveItem cloudDriveItem)
+        {
+            bool result = false;
+            switch (cloudDriveItem.CloudDiskType)
+            {
+                case CloudType.GoogleDrive:
+                     result = await Manager.LoginUser(cloudDriveItem.CloudDiskType);
+                    break;
+            }
 
-        //    OpenCloudDriveCommand = new DelegateCommand(OpenCloudDrive_Click);
-            
+            IshowContentHandler?.Invoke(null, !result);
+        }
 
+        public async void CheckDriveLoginUser(CloudDriveItem cloudDriveItem)
+        {
+            bool result = false;
+            switch (cloudDriveItem.CloudDiskType)
+            {
+                case CloudType.GoogleDrive:
+                    result = await Manager.LoginUser(cloudDriveItem.CloudDiskType);
+                    break;
+            }
         }
 
-     
+
+
     }
 }

+ 104 - 0
PDF Office/ViewModels/HomePanel/CloudDrive/CloudDriveManager.cs

@@ -0,0 +1,104 @@
+using PDF_Office.Model.CloudDrive;
+using PDF_Office.ViewModels.HomePanel.CloudDrive.CloudDriveType;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.ViewModels.HomePanel.CloudDrive
+{
+   
+    //各云盘的管理类
+    //单实例化
+    public class CloudDriveManager
+    {
+       public GoogleDriveManager GoogleDrive => GoogleDriveManager.GoogleDrive;
+       // public DropbBoxManager DropbBox;
+        public CloudType cloudType;
+
+        private static CloudDriveManager instance;
+
+        public static CloudDriveManager GetInstance()
+        {
+            if (instance == null)
+                instance = new CloudDriveManager();
+
+            return instance;
+        }
+        private CloudDriveManager()
+        {
+         //   DropbBox = new DropbBoxManager();
+        }
+
+
+        #region 用户帐号
+
+        /// <summary>
+        /// 登录
+        /// </summary>
+        public async Task<bool> LoginUser(CloudType cloudType)
+        {
+            switch(cloudType)
+            {
+                case CloudType.GoogleDrive:
+                   return await GoogleDrive.LoginUserCount();
+            }
+            return false;
+        }
+
+        public bool LoadedUsers()
+        {
+            bool isUsers = false;
+            if (CloudFilesContentViewModel.CloudFileUserLists.Count > 0)
+                isUsers = true;
+
+            return isUsers;
+
+        }
+        /// <summary>
+        /// 移除用户
+        /// </summary>
+        public async Task<bool> RemoveUser()
+        {
+            GoogleDriveUserItem userIttem = null;
+            switch (cloudType)
+            {
+                case CloudType.OneDrive:
+                    return await GoogleDrive.RemoveUser(userIttem);
+            }
+            return false;
+        }
+
+        /// <summary>
+        /// 切换用户
+        /// </summary>
+        public void SwitchUser()
+        {
+
+        }
+
+
+        #endregion
+
+
+        #region 文件
+
+        public void GetFiles()
+        {
+
+        }
+
+        public void GetFolders()
+        {
+
+        }
+
+        public void UpLoad()
+        {
+
+        }
+        #endregion
+
+    }
+}

+ 79 - 0
PDF Office/ViewModels/HomePanel/CloudDrive/CloudDriveType/DropbBoxManager.cs

@@ -0,0 +1,79 @@
+using Dropbox.Api;
+using PDF_Office.Model.CloudDrive;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.ViewModels.HomePanel.CloudDrive.CloudDriveType
+{
+
+
+    public class DropbBoxManager
+    {
+        private static DropbBoxManager instance;
+        public static DropbBoxManager DropbBox => instance ?? (instance = new DropbBoxManager());
+
+        public DropbBoxManager()
+        {
+        }
+
+
+
+        #region 用户帐号
+
+        /// <summary>
+        /// 登录
+        /// </summary>
+        public void LoginUser()
+        {
+
+        }
+
+        /// <summary>
+        /// 移除用户
+        /// </summary>
+        public void RemoveUser()
+        {
+
+        }
+
+        /// <summary>
+        /// 切换用户
+        /// </summary>
+        public void SwitchUser()
+        {
+
+        }
+
+
+        #endregion
+
+
+        #region 文件
+
+        public void GetFiles()
+        {
+
+        }
+
+        public void GetFolders()
+        {
+
+        }
+
+        public void UpLoad()
+        {
+
+        }
+        #endregion
+
+
+
+
+
+
+
+    }
+}

+ 95 - 11
PDF Office/ViewModels/HomePanel/CloudDrive/DropbBoxUserItem.cs

@@ -1,13 +1,15 @@
 using Dropbox.Api;
+using Dropbox.Api.Files;
 using System;
 using System.Collections.Generic;
+using System.IO;
 using System.Linq;
 using System.Net;
 using System.Text;
 using System.Threading.Tasks;
 using System.Windows;
 
-namespace PDF_Office.ViewModels.HomePanel.CloudDrive
+namespace PDF_Office.ViewModels.HomePanel.CloudDrive.CloudDriveType
 {
     
     public class DropbBoxUserItem
@@ -28,7 +30,7 @@ namespace PDF_Office.ViewModels.HomePanel.CloudDrive
         private string currentFolder = "";
 
         HttpListener http = new HttpListener();
-        private async void btnConnect_Click()
+        private async void Connect()
         {
             DropboxCertHelper.InitializeCertPinning();
             var state = Guid.NewGuid().ToString("N");
@@ -37,16 +39,9 @@ namespace PDF_Office.ViewModels.HomePanel.CloudDrive
             //var http = new HttpListener();
             http.Prefixes.Clear();
             http.Prefixes.Add(LoopbackHost);
-
-
             http.Start();
-
-            //    IAsyncResult result = http.BeginGetContext(new AsyncCallback(ListenerCallback), http);
-
-
             System.Diagnostics.Process.Start(authorizeUri.ToString());
 
-
             await HandleOAuth2Redirect(http);
 
             // Handle redirect from JS and process OAuth response.
@@ -63,8 +58,6 @@ namespace PDF_Office.ViewModels.HomePanel.CloudDrive
 
         }
 
-
-
         public static void ListenerCallback(IAsyncResult result)
         {
             HttpListener listener = (HttpListener)result.AsyncState;
@@ -145,5 +138,96 @@ namespace PDF_Office.ViewModels.HomePanel.CloudDrive
 
 
 
+        private void Download()
+        {
+            //if (ItemList.SelectedItem != null)
+            //{
+            //    var item = ItemList.SelectedItem as Metadata;
+            //    if (item.IsFolder)
+            //        return;
+
+            //    SaveFileDialog saveFileDialog = new SaveFileDialog();
+            //    saveFileDialog.FileName = item.Name;
+            //    if ((bool)saveFileDialog.ShowDialog())
+            //    {
+            //        string folder = item.PathDisplay.Replace("/" + item.Name, "");
+            //        using (var response = await client.Files.DownloadAsync(item.PathDisplay))
+            //        {
+            //            var result = await response.GetContentAsStreamAsync();
+            //            var stream = StreamToMemoryStream(result);
+            //            using (var fileStream = System.IO.File.Create(saveFileDialog.FileName))
+            //            {
+            //                stream.Seek(0, System.IO.SeekOrigin.Begin);
+            //                stream.CopyTo(fileStream);
+            //            }
+            //        }
+            //        MessageBox.Show("下载完成");
+            //        System.Diagnostics.Process.Start(@"explorer.exe", "/select,\"" + saveFileDialog.FileName + "\"");
+            //        RefreshList(folder);
+            //    }
+            //}
+        }
+
+        public MemoryStream StreamToMemoryStream(Stream stream)
+        {
+            MemoryStream memoryStream = new MemoryStream();
+
+            //将基础流写入内存流
+            const int bufferLength = 1024;
+            byte[] buffer = new byte[bufferLength];
+            int actual = stream.Read(buffer, 0, bufferLength);
+            while (actual > 0)
+            {
+                // 读、写过程中,流的位置会自动走。
+                memoryStream.Write(buffer, 0, actual);
+                actual = stream.Read(buffer, 0, bufferLength);
+            }
+            memoryStream.Position = 0;
+
+            return memoryStream;
+        }
+
+        private void Upload()
+        {
+            //if (ItemList.SelectedItem != null)
+            //{
+            //    var item = ItemList.SelectedItem as Metadata;
+            //    if (item.IsFolder)
+            //        return;
+
+            //OpenFileDialog openFileDialog = new OpenFileDialog();
+            //if ((bool)openFileDialog.ShowDialog())
+            //{
+            //    string folder = currentFolder; /*= item.PathDisplay.Replace("/" + item.Name, "");*/
+            //    using (var stream = System.IO.File.OpenRead(openFileDialog.FileName))
+            //    {
+            //        await client.Files.UploadAsync(folder + "/" + openFileDialog.SafeFileName, WriteMode.Overwrite.Instance, body: stream);
+            //    }
+            //    MessageBox.Show("上传完成");
+            //    RefreshList(folder);
+            //}
+            //}
+        }
+
+        private void Loaded()
+        {
+            //var text = sender as TextBlock;
+            //if (text == null)
+            //    return;
+            //if (text.DataContext is Metadata)
+            //{
+            //    var data = (text.DataContext as Metadata);
+            //    if (data.IsFile)
+            //    {
+            //        text.Text = "File";
+            //    }
+            //    if (data.IsFolder)
+            //    {
+            //        text.Text = "Folder";
+            //    }
+            //}
+        }
+
+
     }
 }

+ 120 - 0
PDF Office/ViewModels/HomePanel/CloudDrive/CloudDriveType/GoogleDriveManager.cs

@@ -0,0 +1,120 @@
+using Google.Apis.Auth.OAuth2;
+using Google.Apis.Drive.v3;
+using Google.Apis.Services;
+using Google.Apis.Util.Store;
+using PDF_Office.Model.CloudDrive;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace PDF_Office.ViewModels.HomePanel.CloudDrive.CloudDriveType
+{
+    //多用户UX交互
+    public class GoogleDriveManager
+    {
+        //已登录的所有用户
+     //   public ObservableCollection<CloudFileUser> GoogleDriveUsers = new ObservableCollection<CloudFileUser>();
+
+        private static GoogleDriveManager instance;
+        public static GoogleDriveManager GoogleDrive => instance ?? (instance = new GoogleDriveManager());
+        private GoogleDriveManager()
+        {
+             GoogleDriveStatic.GetFilesPathTemp();
+             GoogleDriveStatic.GetCredentialsPath();
+        }
+
+        #region   请求身份验证
+
+        /// <summary>
+        /// 获取登录过的用户
+        /// </summary>
+        public async Task<bool> GetHistoryUsers()
+        {
+            var tuples = await GoogleDriveStatic.GetHistoryService();
+            CloudFilesContentViewModel.CloudFileUserLists.Clear();
+            foreach (var tuple in tuples)
+            {
+
+                if (tuple != null && tuple.Item1 != null && tuple.Item2 != null)
+                {
+                    AddGoogleDriveUser(tuple);
+                }
+            }
+
+            if (CloudFilesContentViewModel.CloudFileUserLists.Count > 0)
+            {
+                return true;
+            }
+            return false;
+        }
+
+        public async void AddGoogleDriveUser(Tuple<DriveService, UserCredential> tuple)
+        {
+            CloudFileUser cloudFileUser = new CloudFileUser();
+           GoogleDriveUserItem userItem = new GoogleDriveUserItem();
+            userItem.Service = tuple.Item1;
+            userItem.CurrentCredential = tuple.Item2;
+            cloudFileUser.driveItem = userItem;
+          
+            User user = new User();
+            user.UserAccount = await userItem.GetUserAcountAsync();
+            user.cloudType = CloudType.GoogleDrive;
+            cloudFileUser.user = user;
+
+            CloudFilesContentViewModel.CloudFileUserLists.Add(cloudFileUser);
+        }
+
+        public async Task<bool> LoginUserCount()
+        {
+            var tuple = await GoogleDriveStatic.GetServiceAsync();
+            bool result = false;
+            if (tuple != null)
+            {
+                result = true;
+
+           //     Task.Run(async () =>
+           //     {
+
+                    await GetUserInfo(tuple);
+           //     });
+
+            }
+
+            return result;
+        }
+
+        public async Task<bool> GetUserInfo(Tuple<DriveService, UserCredential> tuple)
+        {
+            CloudFileUser cloudFileUser = new CloudFileUser();
+            GoogleDriveUserItem userItem = new GoogleDriveUserItem();
+            userItem.Service = tuple.Item1;
+            userItem.CurrentCredential = tuple.Item2;
+            cloudFileUser.driveItem = userItem;
+
+            User user = new User();
+            user.UserAccount = await userItem.GetUserAcountAsync();
+            user.cloudType = CloudType.GoogleDrive;
+            cloudFileUser.user = user;
+
+            CloudFilesContentViewModel.CloudFileUserLists.Add(cloudFileUser);
+            //GoogleDriveUserItem userItem = new GoogleDriveUserItem();
+            //userItem.Service = tuple.Item1;
+            //userItem.CurrentCredential = tuple.Item2;
+            //userItem.User.UserAccount = await userItem.GetUserAcountAsync();
+            //CloudFilesContentViewModel.CloudFileUserLists.Add(userItem);
+            return true;
+        }
+
+        public async Task<bool> RemoveUser(GoogleDriveUserItem userIttem)
+        {
+           return await userIttem.RemoveUser();
+        }
+
+        #endregion
+    }
+}

+ 139 - 13
PDF Office/ViewModels/HomePanel/CloudDrive/GoogleDriveUserItem.cs

@@ -12,34 +12,41 @@ using System.Text;
 using System.Threading;
 using System.Threading.Tasks;
 
-namespace PDF_Office.ViewModels.HomePanel.CloudDrive
+namespace PDF_Office.ViewModels.HomePanel.CloudDrive.CloudDriveType
 {
 
-    //对单用户账号处理核心功能
-    public class GoogleDriveUserItem
+    /// <summary>
+    /// 对单账号处理的核心功能类
+    /// </summary>
+    public class GoogleDriveUserItem: UserBaseItem
     {
-        public GoogleDriveUser User { get;  set; }
-        public  DriveService Service { get; set; }
-        private List<GoogleDriveFiles> GoogleDriveFilesList = new List<GoogleDriveFiles>();
+       
+        public  DriveService Service { get; set; }//Google提供服务
+        private List<GoogleDriveFiles> FilesList = new List<GoogleDriveFiles>();//文件
+
+        public UserCredential CurrentCredential { get; set; }//当前用户访问令牌
 
         public GoogleDriveUserItem()
         {
-            User = new GoogleDriveUser();
+         //   User = new User();
             
         }
       
-
         #region   对用户账号处理
 
+        /// <summary>
+        /// 移除用户帐号
+        /// </summary>
+        /// <returns>移除后的状态</returns>
         public async Task<bool> RemoveUser()
         {
             bool result = false;
-            if (User.CurrentCredential != null)
+            if (CurrentCredential != null)
             {
-                result = await User.CurrentCredential.RevokeTokenAsync(CancellationToken.None);
+                result = await CurrentCredential.RevokeTokenAsync(CancellationToken.None);
             }
             if (result == true)
-                User.CurrentCredential = null;
+                CurrentCredential = null;
 
             return result;
         }
@@ -92,7 +99,7 @@ namespace PDF_Office.ViewModels.HomePanel.CloudDrive
                 return null;
 
             // define parameters of request.
-            FilesResource.ListRequest FileListRequest = service.Files.List();
+            FilesResource.ListRequest FileListRequest = service.Files.List(); 
 
             //listRequest.PageSize = 10;
             //listRequest.PageToken = 10;
@@ -106,7 +113,7 @@ namespace PDF_Office.ViewModels.HomePanel.CloudDrive
             {
                 foreach (var file in files)
                 {
-                    GoogleDriveFiles File = new GoogleDriveFiles
+                       GoogleDriveFiles File = new GoogleDriveFiles
                     {
                         Id = file.Id,
                         Name = file.Name,
@@ -225,4 +232,123 @@ namespace PDF_Office.ViewModels.HomePanel.CloudDrive
 
         #endregion
     }
+
+
+    public static class GoogleDriveStatic
+    {
+        public static string[] Scopes = { DriveService.Scope.Drive };
+        //Google Drive应用名称
+        private static readonly string GoogleDriveAppName = "PDF Office848";
+        //请求应用进行身份验证的信息
+        public static string CredentialsPath { get; private set; }
+
+        //存放已通过身份验证的用户信息,以便下次不用登录便可使用云文档
+        public static string FilesPathTemp { get; private set; }
+        /// <summary>
+        ///  异步获取Google服务的包信息,避免UI线程卡死
+        /// </summary>
+        /// <param name="userInfoFile"></param>
+        [Obsolete]
+        public static async Task<Tuple<DriveService, UserCredential>> GetServiceAsync(string userInfoFile = "")
+        {
+            Tuple<DriveService, UserCredential> tuple = null;
+            await Task.Run(() =>
+            {
+                tuple = GetService(userInfoFile);
+            });
+            return tuple;
+        }
+
+        /// <summary>
+        /// 获取Google服务的包信息(包含访问令牌,App Key密钥等)
+        /// </summary>
+        /// <param name="FilePath">登录过的用户文件;若为空,则为新用户登录</param>
+        /// <returns></returns>
+        [Obsolete]
+        public static Tuple<DriveService, UserCredential> GetService(string FilePath = "")
+        {
+            Tuple<DriveService, UserCredential> tuple = null;
+            UserCredential credential;
+
+            if (FilePath == "")
+            {
+                var time = DateTime.Now.ToString("yyyyMMddHHmmss");
+                FilePath = System.IO.Path.Combine(FilesPathTemp, time + ".json");
+            }
+
+
+            using (var stream = new FileStream(CredentialsPath, FileMode.Open, FileAccess.Read))
+            {
+                credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
+                    GoogleClientSecrets.Load(stream).Secrets,
+                    Scopes,
+                    "user",
+                    CancellationToken.None,
+                    new FileDataStore(FilePath, true)).Result;
+            }
+
+            //create Drive API service.
+            DriveService service = new DriveService(new BaseClientService.Initializer()
+            {
+                HttpClientInitializer = credential,
+                ApplicationName = GoogleDriveAppName
+            });
+
+            return tuple = new Tuple<DriveService, UserCredential>(service, credential);
+        }
+
+
+        /// <summary>
+        /// 获取登录过的账号
+        /// </summary>
+        /// <returns>历史账号</returns>
+        public static async Task<List<Tuple<DriveService, UserCredential>>> GetHistoryService()
+        {
+            DirectoryInfo TheFolder = new DirectoryInfo(FilesPathTemp);
+            List<Tuple<DriveService, UserCredential>> DriveServices = new List<Tuple<DriveService, UserCredential>>();
+
+            foreach (var directorieItem in TheFolder.GetDirectories())
+            {
+                var driveServiceItem = await GetServiceAsync(directorieItem.Name);
+
+                if (driveServiceItem != null)
+                {
+                    DriveServices.Add(driveServiceItem);
+                }
+            }
+            return DriveServices;
+        }
+
+
+
+        #region  云文档的用户帐户缓存路径和身份验证文件
+
+        /// <summary>
+        /// 获取或创建缓存登录帐户信息
+        /// </summary>
+        public static string GetFilesPathTemp()
+        {
+            string str_1 = System.AppDomain.CurrentDomain.BaseDirectory;
+            String FolderPath = str_1 + "GoogleDriveUsers";
+
+            if (Directory.Exists(FolderPath) == false)
+                Directory.CreateDirectory(FolderPath);
+
+            FilesPathTemp = FolderPath;
+            return FolderPath;
+        }
+
+        /// <summary>
+        /// 获取本地身份验证文件
+        /// </summary>
+        public static string GetCredentialsPath()
+        {
+            string str_1 = System.AppDomain.CurrentDomain.BaseDirectory;
+            String filePath = str_1 + @"\credentials.json";
+            CredentialsPath = filePath;
+            return filePath;
+        }
+
+        #endregion
+    }
 }

+ 65 - 12
PDF Office/ViewModels/HomePanel/CloudDrive/CloudFilesContentViewModel.cs

@@ -1,7 +1,10 @@
-using Prism.Commands;
+using PDF_Office.Model.CloudDrive;
+using PDF_Office.ViewModels.HomePanel.CloudDrive.CloudDriveType;
+using Prism.Commands;
 using Prism.Mvvm;
 using System;
 using System.Collections.Generic;
+using System.Collections.ObjectModel;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -11,21 +14,23 @@ namespace PDF_Office.ViewModels.HomePanel.CloudDrive
     //各云盘事件
     public class CloudFilesContentViewModel : BindableBase
     {
-        public GoogleDriveManager GoogleDrive;
-
+        public static ObservableCollection<CloudFileUser> CloudFileUserLists = new ObservableCollection<CloudFileUser>();
+        public GoogleDriveManager GoogleDrive => GoogleDriveManager.GoogleDrive;
+        public DropbBoxManager DropbBox => DropbBoxManager.DropbBox;
         public DelegateCommand OpenCloudDriveCommand { get; set; }
         public DelegateCommand CheckDriveUsersCommand { get; set; }
 
         //向外触发
-        public event EventHandler<bool> isFoundUserHandler;
+      //  public event EventHandler<bool> isFoundUserHandler;
         public CloudFilesContentViewModel()
         {
-            GoogleDrive = new GoogleDriveManager();
+          //  Manager = new GoogleDriveManager(); 
+         //   GoogleDrive = new GoogleDriveManager();
 
             OpenCloudDriveCommand = new DelegateCommand(OpenCloudDrive_Click);
             OpenCloudDriveCommand = new DelegateCommand(CheckDriveUsers);
 
-            CheckDriveUsersCommand = new DelegateCommand(CheckDriveUsers);
+          //  CheckDriveUsersCommand = new DelegateCommand(CheckDriveUsers);
 
 
          
@@ -35,8 +40,9 @@ namespace PDF_Office.ViewModels.HomePanel.CloudDrive
 
         public async void CheckDriveUsers()
         {
-            var result = await GetHistoryUser();
-            isFoundUserHandler?.Invoke(null, result);
+            //   var result = await GetHistoryUser();
+            //    isFoundUserHandler?.Invoke(null, result);
+         // await  GoogleDrive.LoginUderCount();
 
         }
 
@@ -58,10 +64,10 @@ namespace PDF_Office.ViewModels.HomePanel.CloudDrive
         {
             bool isFound = false;
 
-            if (await GoogleDrive.GetHistoryUsers())
-            {
-                isFound = true;
-            }
+            //if (await GoogleDrive.GetHistoryUsers())
+            //{
+            //    isFound = true;
+            //}
             return isFound;
 
         }
@@ -71,6 +77,53 @@ namespace PDF_Office.ViewModels.HomePanel.CloudDrive
 
 
 
+        #region 用户帐号
+
+        /// <summary>
+        /// 登录
+        /// </summary>
+        public void LoginUser()
+        {
+           
+        }
+
+        /// <summary>
+        /// 移除用户
+        /// </summary>
+        public void RemoveUser()
+        {
+
+        }
+
+        /// <summary>
+        /// 切换用户
+        /// </summary>
+        public void SwitchUser()
+        {
+
+        }
+
+
+        #endregion
+
+
+        #region 文件
+        
+        public void GetFiles()
+        {
+
+        }
+
+        public void GetFolders()
+        {
+
+        }
+
+        public void UpLoad()
+        {
+
+        }
+        #endregion
 
     }
 }

+ 0 - 16
PDF Office/ViewModels/HomePanel/CloudDrive/DropbBoxManager.cs

@@ -1,16 +0,0 @@
-using Dropbox.Api;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace PDF_Office.ViewModels.HomePanel.CloudDrive
-{
-
-    public class DropbBoxManager
-    {
-        
-
-    }
-}

+ 0 - 179
PDF Office/ViewModels/HomePanel/CloudDrive/GoogleDriveManager.cs

@@ -1,179 +0,0 @@
-using Google.Apis.Auth.OAuth2;
-using Google.Apis.Drive.v3;
-using Google.Apis.Services;
-using Google.Apis.Util.Store;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace PDF_Office.ViewModels.HomePanel.CloudDrive
-{
-    //多用户UX交互
-    public class GoogleDriveManager
-    {
-        public static string[] Scopes = { DriveService.Scope.Drive };
-        //Google Drive应用名称
-        private static readonly string GoogleDriveAppName = "PDF Office";
-        //请求应用进行身份验证的信息
-        public static string CredentialsPath { get; private set; }
-        //存放已通过身份验证的用户信息,以便下次不用登录便可使用云文档
-        public static string FilesPathTemp { get; private set; }
-
-        //已登录的用户们
-        public List<GoogleDriveUserItem> GoogleDriveUsers = new List<GoogleDriveUserItem>();
-
-
-        public GoogleDriveManager()
-        {
-            GetFilesPathTemp();
-            GetCredentialsPath();
-        }
-
-
-        #region  云文档的用户帐户缓存路径和身份验证文件
-
-        /// <summary>
-        /// 获取或创建缓存登录帐户信息
-        /// </summary>
-        public void GetFilesPathTemp()
-        {
-            string str_1 = System.AppDomain.CurrentDomain.BaseDirectory;
-            String FolderPath = str_1 + "GoogleDriveUsers";
-
-            if (Directory.Exists(FolderPath) == false)
-                Directory.CreateDirectory(FolderPath);
-
-            FilesPathTemp = FolderPath;
-        }
-
-        /// <summary>
-        /// 获取本地身份验证文件
-        /// </summary>
-        public void GetCredentialsPath()
-        {
-            string str_1 = System.AppDomain.CurrentDomain.BaseDirectory;
-            String filePath = str_1 + @"\credentials.json";
-            CredentialsPath = filePath;
-        }
-
-        #endregion
-
-
-        #region   请求身份验证
-
-        /// <summary>
-        /// 获取登录过的用户
-        /// </summary>
-        public async Task<bool> GetHistoryUsers()
-        {
-            var tuples = await GetHistoryService();
-            GoogleDriveUsers.Clear();
-            foreach (var tuple in tuples)
-            {
-
-                if (tuple != null && tuple.Item1 != null && tuple.Item2 != null)
-                {
-                    AddGoogleDriveUser(tuple);
-                }
-            }
-
-            if (GoogleDriveUsers.Count > 0)
-            {
-                return true;
-            }
-            return false;
-        }
-
-        public async void AddGoogleDriveUser(Tuple<DriveService, UserCredential> tuple)
-        {
-            GoogleDriveUserItem user = new GoogleDriveUserItem();
-            user.Service = tuple.Item1;
-            user.User.CurrentCredential = tuple.Item2;
-            user.User.UserAccount = await user.GetUserAcountAsync();
-            GoogleDriveUsers.Add(user);
-        }
-
-
-
-        /// <summary>
-        /// 获取登录过的账号
-        /// </summary>
-        /// <returns>历史账号</returns>
-        private async Task<List<Tuple<DriveService, UserCredential>>> GetHistoryService()
-        {
-            DirectoryInfo TheFolder = new DirectoryInfo(GoogleDriveManager.FilesPathTemp);
-            List<Tuple<DriveService, UserCredential>> DriveServices = new List<Tuple<DriveService, UserCredential>>();
-
-            foreach (var directorieItem in TheFolder.GetDirectories())
-            {
-                var driveServiceItem = await GetServiceAsync(directorieItem.Name);
-
-                if (driveServiceItem != null)
-                {
-                    DriveServices.Add(driveServiceItem);
-                }
-            }
-            return DriveServices;
-        }
-
-        /// <summary>
-        ///  异步获取Google服务的包信息,避免UI线程卡死
-        /// </summary>
-        /// <param name="userInfoFile"></param>
-        [Obsolete]
-        public async Task<Tuple<DriveService, UserCredential>> GetServiceAsync(string userInfoFile = "")
-        {
-            Tuple<DriveService, UserCredential> tuple = null;
-            await Task.Run(() =>
-            {
-                tuple = GetService(userInfoFile);
-            });
-            return tuple;
-        }
-
-        /// <summary>
-        /// 获取Google服务的包信息(包含访问令牌,App Key密钥等)
-        /// </summary>
-        /// <param name="FilePath">登录过的用户文件;若为空,则为新用户登录</param>
-        /// <returns></returns>
-        [Obsolete]
-        private Tuple<DriveService, UserCredential> GetService(string FilePath = "")
-        {
-            Tuple<DriveService, UserCredential> tuple = null;
-            UserCredential credential;
-
-            if (FilePath == "")
-            {
-                var time = DateTime.Now.ToString("yyyyMMddHHmmss");
-                FilePath = System.IO.Path.Combine(GoogleDriveManager.FilesPathTemp, time + ".json");
-            }
-
-
-            using (var stream = new FileStream(GoogleDriveManager.CredentialsPath, FileMode.Open, FileAccess.Read))
-            {
-                credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
-                    GoogleClientSecrets.Load(stream).Secrets,
-                    Scopes,
-                    "user",
-                    CancellationToken.None,
-                    new FileDataStore(FilePath, true)).Result;
-            }
-
-            //create Drive API service.
-            DriveService service = new DriveService(new BaseClientService.Initializer()
-            {
-                HttpClientInitializer = credential,
-                ApplicationName = GoogleDriveAppName
-            });
-
-            return tuple = new Tuple<DriveService, UserCredential>(service, credential);
-        }
-
-
-        #endregion
-    }
-}

+ 3 - 2
PDF Office/ViewModels/HomePanel/HomeCloudContentViewModel.cs

@@ -1,5 +1,6 @@
 using PDF_Office.Model.CloudDrive;
 using PDF_Office.ViewModels.HomePanel.CloudDrive;
+using PDF_Office.ViewModels.HomePanel.CloudDrive.CloudDriveType;
 using Prism.Commands;
 using Prism.Mvvm;
 using System;
@@ -12,12 +13,12 @@ namespace PDF_Office.ViewModels.HomePanel
 {
     public class HomeCloudContentViewModel:BindableBase
     {
-        public GoogleDriveManager googleDriveViewModel;
+     //   public GoogleDriveManager googleDriveManager;
         
         public DelegateCommand<CloudDriveItem> OpenCloudDriveCommand { get; set; }
         public HomeCloudContentViewModel()
         {
-            googleDriveViewModel = new GoogleDriveManager();
+         //   googleDriveManager = new GoogleDriveManager();
             OpenCloudDriveCommand = new DelegateCommand<CloudDriveItem>(OpenCloudDrive_Click);
         }
 

+ 1 - 1
PDF Office/Views/HomePanel/CloudDrive/CloudDriveContent.xaml

@@ -17,7 +17,7 @@
 
         <Grid>
             <TextBlock Text="Cloud Drive" HorizontalAlignment="Left"/>
-            <ComboBox x:Name="combCloudDrive" Width="115" Height="32" Background="Wheat" HorizontalAlignment="Right">
+            <ComboBox x:Name="combCloudDrive" Width="115" Height="32" Background="Wheat" HorizontalAlignment="Right" SelectionChanged="combCloudDrive_SelectionChanged">
                 <ComboBox.ItemTemplate>
                     <DataTemplate>
                         <Border Background="#DBDBDB">

+ 40 - 0
PDF Office/Views/HomePanel/CloudDrive/CloudDriveContent.xaml.cs

@@ -1,4 +1,5 @@
 using PDF_Office.Model.CloudDrive;
+using PDF_Office.ViewModels.HomePanel.CloudDrive;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -22,11 +23,29 @@ namespace PDF_Office.Views.HomePanel.CloudDrive
     public partial class CloudDriveContent : UserControl
     {
         private List<CloudDriveItem> CloudeDrives = new List<CloudDriveItem>();
+        private CloudDriveContentViewModel ViewModel => DataContext as CloudDriveContentViewModel;
+
         public CloudDriveContent()
         {
             InitializeComponent();
             InitCloudDrive();
 
+            Loaded += CloudDriveContent_Loaded;
+        }
+
+        private void CloudDriveContent_Loaded(object sender, RoutedEventArgs e)
+        {
+            if (ViewModel != null)
+            {
+                ViewModel.IshowContentHandler -= ViewModel_IshowContent;
+                ViewModel.IshowContentHandler += ViewModel_IshowContent;
+                ViewModel.LoadUsers();
+            }
+        }
+
+        private void ViewModel_IshowContent(object sender, bool e)
+        {
+          IsShow = e;
         }
 
         private void InitCloudDrive()
@@ -50,8 +69,29 @@ namespace PDF_Office.Views.HomePanel.CloudDrive
 
         private void SelectCloudDrive_Click(object sender, MouseButtonEventArgs e)
         {
+           var cloudDriveItem = (sender as FrameworkElement).DataContext as CloudDriveItem;
+            if(cloudDriveItem != null)
+            {
+                ViewModel.CheckDriveCommand.Execute(cloudDriveItem);
+            }
+        }
 
+        private void combCloudDrive_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+            var cloudDriveItem = combCloudDrive.SelectedItem as CloudDriveItem;
+            if (cloudDriveItem != null)
+            {
+                ViewModel.CheckDriveCommand.Execute(cloudDriveItem);
+            }
+        }
 
+        public bool IsShow
+        {
+            get { return (bool)GetValue(IsShowProperty); }
+            set { SetValue(IsShowProperty, value); }
         }
+        public static readonly DependencyProperty IsShowProperty =
+           DependencyProperty.Register("IsShow", typeof(bool), typeof(CloudDriveContent), new PropertyMetadata(true));
+
     }
 }

+ 39 - 11
PDF Office/Views/HomePanel/CloudDrive/CloudFilesContent.xaml

@@ -8,10 +8,36 @@
              xmlns:local="clr-namespace:PDF_Office.Views.HomePanel.CloudDrive"
              mc:Ignorable="d" 
              d:DesignHeight="450" d:DesignWidth="800">
+    <UserControl.Resources>
+        <ContextMenu x:Key="FlyoutMenu" FontSize="14"
+                         >
+            <ContextMenu.ItemContainerStyle>
+                <Style TargetType="MenuItem">
+                    <Setter Property="Padding" Value="0,7,0,7"/>
+                    <Setter Property="VerticalContentAlignment" Value="Center"/>
+                </Style>
+            </ContextMenu.ItemContainerStyle>
+            <MenuItem Name="OpenDocMenuItem" Header="打开文件" IsEnabled="True" Click="OpenDocMenuItem_Click">
+                <MenuItem.Icon>
+                    <Path Fill="Black" Data="M9 0H3V2H0V3H1V14H11V3H12V2H9V0ZM2 13V3H3H4H8H9H10V13H2ZM8 2V1H4V2H8ZM4 12V4H3V12H4ZM6.5 4V12H5.5V4H6.5ZM9 12V4H8V12H9Z">
+                        <Path.RenderTransform>
+                            <TranslateTransform X="5.0000" Y="0"/>
+                        </Path.RenderTransform>
+                    </Path>
+                </MenuItem.Icon>
+            </MenuItem>
+   
+
+        </ContextMenu>
+
+        <Style x:Key="itemstyle" TargetType="{x:Type ListViewItem}">
+            <Setter Property="ContextMenu" Value="{StaticResource FlyoutMenu}"></Setter>
+        </Style>
+    </UserControl.Resources>
     <Grid>
         <Grid.RowDefinitions>
             <RowDefinition Height="auto"/>
-            <RowDefinition Height="auto"/>
+            <RowDefinition/>
         </Grid.RowDefinitions>
         <Grid HorizontalAlignment="Stretch">
             <Grid.ColumnDefinitions>
@@ -25,29 +51,31 @@
                     </ItemsPanelTemplate>
                 </ListBox.ItemsPanel>
             </ListBox>
-            <StackPanel Orientation="Horizontal">
+            <StackPanel Grid.Column="1" Orientation="Horizontal">
                 <ComboBox x:Name="combCloudDisk" Grid.Column="1" Width="115" Height="32" Background="Wheat" HorizontalAlignment="Right"/>
                 <Button Content="Test" Click="Button_Click"/>
             </StackPanel>
            
         </Grid>
 
-        <Grid Grid.Row="1">
+        <Grid Grid.Row="1" >
             <Grid.ColumnDefinitions>
                 <ColumnDefinition Width="Auto"/>
                 <ColumnDefinition/>
             </Grid.ColumnDefinitions>
 
-            <ListBox x:Name="Listusers" Width="170">
-                <ListBox.ItemTemplate>
+            <ListView x:Name="Listusers" Width="220"  SelectionChanged="Listusers_SelectionChanged" VerticalAlignment="Top">
+                <ListView.ItemTemplate>
                     <DataTemplate>
-                        <TextBlock Text="{Binding UserAccount}"/>
-                        
+                        <Grid Height="50" >
+                            <TextBlock VerticalAlignment="Center" Text="{Binding user.UserAccount}"/>
+                        </Grid>
+                       
                     </DataTemplate>
-                </ListBox.ItemTemplate>
-            </ListBox>
-            
-            <ListView x:Name="ListvmFiles" Grid.Column="1" >
+                </ListView.ItemTemplate>
+            </ListView>
+
+            <ListView x:Name="ListvmFiles" Grid.Column="1" ScrollViewer.VerticalScrollBarVisibility="Auto" ItemContainerStyle="{StaticResource itemstyle}">
                 <ListView.ItemTemplate>
                     <DataTemplate>
                         <StackPanel Margin="0,5,0,5">

+ 69 - 40
PDF Office/Views/HomePanel/CloudDrive/CloudFilesContent.xaml.cs

@@ -1,7 +1,10 @@
-using PDF_Office.Model.CloudDrive;
+using Microsoft.Win32;
+using PDF_Office.Model.CloudDrive;
 using PDF_Office.ViewModels.HomePanel.CloudDrive;
+using PDF_Office.ViewModels.HomePanel.CloudDrive.CloudDriveType;
 using System;
 using System.Collections.Generic;
+using System.Collections.ObjectModel;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -22,52 +25,44 @@ namespace PDF_Office.Views.HomePanel.CloudDrive
     /// </summary>
     public partial class CloudFilesContent : UserControl
     {
-        private List<string> list = new List<string>();
-      //  private GoogleDriveViewModel GoogleDrive = new GoogleDriveViewModel();
+     
+        private CloudFilesContentViewModel ViewModel => DataContext as CloudFilesContentViewModel;
 
-        private CloudFilesContentViewModel CloudFilesDrive=>DataContext as CloudFilesContentViewModel;
+        private List<CloudDriveItem> CloudeDrives = new List<CloudDriveItem>();
 
         private CloudType cloudType;
         public CloudFilesContent()
         {
             InitializeComponent();
-            list.Add("Box");
-            list.Add("DropBox");
-            list.Add("GoogleDrive");
-            list.Add("OneDrive");
-            ListFolder.ItemsSource = list;
-            // Listusers.ItemsSource = list;
-            //  combCloudDisk.ItemsSource = list;
-            // ListvmFiles.ItemsSource = list;
+            InitCloudDrive();
             this.Loaded += usercontrol_Loaded;
         }
 
-        private void usercontrol_Loaded(object sender, RoutedEventArgs e)
+        private void InitCloudDrive()
         {
-          if(CloudFilesDrive != null)
-            {
-                CloudFilesDrive.isFoundUserHandler += isFoundUserEvent;
-                CloudFilesDrive.CheckDriveUsers();
-            }
+            var cloudDriveItem = new CloudDriveItem(CloudType.Box);
+            CloudeDrives.Add(cloudDriveItem);
+
+            cloudDriveItem = new CloudDriveItem(CloudType.DropBox);
+            CloudeDrives.Add(cloudDriveItem);
+
+            cloudDriveItem = new CloudDriveItem(CloudType.GoogleDrive);
+            CloudeDrives.Add(cloudDriveItem);
+
+            cloudDriveItem = new CloudDriveItem(CloudType.OneDrive);
+            CloudeDrives.Add(cloudDriveItem);
+
+            combCloudDisk.ItemsSource = CloudeDrives;
+            combCloudDisk.SelectedIndex = 0;
         }
 
-        private async void isFoundUserEvent(object sender, bool e)
+        private void usercontrol_Loaded(object sender, RoutedEventArgs e)
         {
-            isShow = e;
-            if(isShow)
+          if(ViewModel != null)
             {
-                List<GoogleDriveUser> GoogleDriveUsers = new List<GoogleDriveUser>();
-            //    await Task.Run(async () =>
-             //   {
-                    foreach (var item in CloudFilesDrive.GoogleDrive.GoogleDriveUsers)
-                    {
-
-                        GoogleDriveUsers.Add(item.User);
-                    }
-             //   });
-
-                
-                Listusers.ItemsSource = GoogleDriveUsers;
+                ViewModel.CheckDriveUsers();
+                if (Listusers.ItemsSource == null)
+                    Listusers.ItemsSource = CloudFilesContentViewModel.CloudFileUserLists;
             }
         }
 
@@ -83,18 +78,52 @@ namespace PDF_Office.Views.HomePanel.CloudDrive
 
         private void Button_Click(object sender, RoutedEventArgs e)
         {
-            SelectCloudTye(CloudType.GoogleDrive);
-        }
 
+         //  SelectCloudTye(CloudType.GoogleDrive);
+        }
 
+        private CloudFileUser CurrentUser;
+        
 
-        public bool isShow
+        private async void Listusers_SelectionChanged(object sender, SelectionChangedEventArgs e)
         {
-            get { return (bool)GetValue(NormalIconProperty); }
-            set { SetValue(NormalIconProperty, value); }
+            var cloudFileUser = Listusers.SelectedItem as CloudFileUser;
+            if(cloudFileUser != null)
+            {
+                CurrentUser = cloudFileUser;
+                if ((CurrentUser.driveItem as GoogleDriveUserItem) != null)
+                {
+                    var item = CurrentUser.driveItem as GoogleDriveUserItem;
+                    var files = await item.GetDriveFiles(item.Service);
+                    ObservableCollection<GoogleDriveFiles> filesList = new ObservableCollection<GoogleDriveFiles>();
+                    foreach (var file in files)
+                    {
+                        if(file.Name.EndsWith(".pdf") == true)
+                        {
+                            filesList.Add(file);
+                        }
+                    }
+                    ListvmFiles.ItemsSource = filesList;
+                }
+            }
         }
-        public static readonly DependencyProperty NormalIconProperty =
-           DependencyProperty.Register("isShow", typeof(bool), typeof(CloudFilesContent), new PropertyMetadata(false));
 
+        private async void OpenDocMenuItem_Click(object sender, RoutedEventArgs e)
+        {
+            var menuItem = sender as MenuItem;
+           var item = menuItem.DataContext as GoogleDriveFiles;
+
+            var googleItem = CurrentUser.driveItem as GoogleDriveUserItem;
+            string docPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
+
+            var filename = await googleItem.DownloadGoogleFile(item, docPath);
+            if (filename != null)
+            {
+                string[] filePaths = { filename };
+                await Task.Delay(3);
+                MainWindow parentWindow = Window.GetWindow(this) as MainWindow;
+                parentWindow.LoadPdfViewer(filePaths);
+            }
+        }
     }
 }

+ 2 - 2
PDF Office/Views/HomePanel/HomeCloudContent.xaml

@@ -18,7 +18,7 @@
         </ResourceDictionary>
     </UserControl.Resources>
     <Grid>
-        <Cloud:CloudDriveContent x:Name="cloudDriveContent" Visibility="{Binding ElementName=cloudFilesContent,Path=isShow, Converter={StaticResource  InvertBoolToVisibleConvert}}" />
-        <Cloud:CloudFilesContent x:Name="cloudFilesContent"  Visibility="{Binding ElementName=cloudFilesContent,Path=isShow, Converter={StaticResource BoolToVisibleConvert}}"/>
+        <Cloud:CloudDriveContent x:Name="cloudDriveContent" Visibility="{Binding ElementName=cloudDriveContent,Path=IsShow, Converter={StaticResource  BoolToVisibleConvert}}" />
+        <Cloud:CloudFilesContent x:Name="cloudFilesContent"  Visibility="{Binding ElementName=cloudDriveContent,Path=IsShow, Converter={StaticResource InvertBoolToVisibleConvert}}"/>
     </Grid>
 </UserControl>

+ 0 - 25
PDF Office/Views/HomePanel/HomeCloudContent.xaml.cs

@@ -24,32 +24,7 @@ namespace PDF_Office.Views.HomePanel
         public HomeCloudContent()
         {
             InitializeComponent();
-            this.Loaded += HomeCloudContent_Loaded;
-
-        }
-
-        private void HomeCloudContent_Loaded(object sender, RoutedEventArgs e)
-        {
-           var cloudDrives = cloudFilesContent.DataContext as CloudFilesContentViewModel;
-            if(cloudDrives != null)
-            {
-                cloudDrives.CheckDriveUsersCommand.Execute();
-            }
         }
 
-
-        private void cloudDiskContent_OpenCloudDriveHandler(object sender, bool e)
-        {
-            if(e)
-            {
-                cloudDriveContent.Visibility = Visibility.Collapsed;
-                cloudFilesContent.Visibility = Visibility.Visible;
-            }
-        }
-
-        private void LoadCloudDrive()
-        {
-
-        }
     }
 }