Example #1
0
 public SelectDrivePopup()
 {
     Drives = new ObservableCollection <DriveBinder>();
     foreach (var d in LocalDriveInfo.GetDrives())
     {
         Drives.Add(new DriveBinder(d));
     }
     EventManager.RegisterClassHandler(typeof(SelectDrivePopup), DriveListItem.DriveSelectedEvent, new RoutedSelectDriveEventHandler(driveSelected));
 }
Example #2
0
        private void OpenLocalDriverCommandBinding_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            LocalDriveInfo driveInfo = e.Parameter as LocalDriveInfo;

            HandyControl.Controls.TabItem tabItem2 = new HandyControl.Controls.TabItem();
            tabItem2.Header = driveInfo.Name;
            FileExplorerView fileExplorerView = new FileExplorerView();

            tabItem2.Content = fileExplorerView;
            fileExplorerView.Navigate(driveInfo.Name);
            tabControl.Items.Add(tabItem2);
            tabControl.SelectedIndex = tabControl.Items.Count - 1;//选择最后一个
        }
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            LocalDriveInfo localDriveInfo = value as LocalDriveInfo;

            if (localDriveInfo == null || localDriveInfo.AvailableFreeSpace == null || localDriveInfo.TotalSize == null)
            {
                return("容量未知");
            }
            else
            {
                return($"{FileUtil.GetFileSizeGB(localDriveInfo.AvailableFreeSpace)}可用 共{FileUtil.GetFileSizeGB(localDriveInfo.TotalSize)}");
            }
        }