123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- using PDF_Office.Model.CloudDrive;
- using PDF_Office.ViewModels.HomePanel.CloudDrive;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- using System.Windows.Shapes;
- namespace PDF_Office.Views.HomePanel.CloudDrive
- {
- /// <summary>
- /// CloudFilesContent.xaml 的交互逻辑
- /// </summary>
- public partial class CloudFilesContent : UserControl
- {
- private List<string> list = new List<string>();
- // private GoogleDriveViewModel GoogleDrive = new GoogleDriveViewModel();
- private CloudFilesContentViewModel CloudFilesDrive=>DataContext as CloudFilesContentViewModel;
- 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;
- this.Loaded += usercontrol_Loaded;
- }
- private void usercontrol_Loaded(object sender, RoutedEventArgs e)
- {
- if(CloudFilesDrive != null)
- {
- CloudFilesDrive.isFoundUserHandler += isFoundUserEvent;
- CloudFilesDrive.CheckDriveUsers();
- }
- }
- private async void isFoundUserEvent(object sender, bool e)
- {
- isShow = e;
- if(isShow)
- {
- List<GoogleDriveUser> GoogleDriveUsers = new List<GoogleDriveUser>();
- // await Task.Run(async () =>
- // {
- foreach (var item in CloudFilesDrive.GoogleDrive.GoogleDriveUsers)
- {
- GoogleDriveUsers.Add(item.User);
- }
- // });
-
- Listusers.ItemsSource = GoogleDriveUsers;
- }
- }
- public void SelectCloudTye(CloudType cloudType)
- {
- switch (cloudType)
- {
- case CloudType.GoogleDrive:
- cloudType = CloudType.GoogleDrive;
- break;
- }
- }
- private void Button_Click(object sender, RoutedEventArgs e)
- {
- SelectCloudTye(CloudType.GoogleDrive);
- }
- public bool isShow
- {
- get { return (bool)GetValue(NormalIconProperty); }
- set { SetValue(NormalIconProperty, value); }
- }
- public static readonly DependencyProperty NormalIconProperty =
- DependencyProperty.Register("isShow", typeof(bool), typeof(CloudFilesContent), new PropertyMetadata(false));
- }
- }
|