1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- using PDF_Master.Model.CloudDrive;
- using PDF_Master.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_Master.Views.HomePanel.CloudDrive
- {
- /// <summary>
- /// CloudDriveContent.xaml 的交互逻辑
- /// </summary>
- public partial class CloudDriveContent : UserControl
- {
- private List<CloudBoxItem> CloudBoxs = new List<CloudBoxItem>();
- 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()
- {
- CloudBoxs = Cloud.InitCloudBoxs();
- ListCloudDrive.ItemsSource = CloudBoxs;
- combCloudDrive.ItemsSource = CloudBoxs;
- combCloudDrive.SelectedIndex = 0;
- }
- private void SelectCloudDrive_Click(object sender, MouseButtonEventArgs e)
- {
- var cloudDriveItem = (sender as FrameworkElement).DataContext as CloudBoxItem;
- if(cloudDriveItem != null)
- {
- ViewModel.CheckDriveCommand.Execute(cloudDriveItem);
- }
- }
- private void combCloudDrive_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- var cloudDriveItem = combCloudDrive.SelectedItem as CloudBoxItem;
- 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));
- }
- }
|