public TaskDataSelectionForm() { InitializeComponent(); Theming.ApplyTheme(this); file.Checked = true; foreach (VolumeInfo volume in VolumeInfo.Volumes) { DriveType driveType = volume.VolumeType; if (driveType != DriveType.Unknown && driveType != DriveType.NoRootDirectory && driveType != DriveType.CDRom && driveType != DriveType.Network) { if (!volume.IsMounted) continue; DriveItem item = new DriveItem(); string volumePath = volume.MountPoints[0]; DirectoryInfo root = new DirectoryInfo(volumePath); item.Drive = volumePath; item.Label = root.GetDescription(); item.Icon = root.GetIcon(); unusedDisk.Items.Add(item); } } if (unusedDisk.Items.Count != 0) unusedDisk.SelectedIndex = 0; Dictionary<Guid, ErasureMethod> methods = ErasureMethodManager.Items; this.method.Items.Add(ErasureMethodManager.Default); foreach (ErasureMethod method in methods.Values) this.method.Items.Add(method); if (this.method.Items.Count != 0) this.method.SelectedIndex = 0; }
private ListViewItem CreateListViewItem(DirectoryInfo di) { StackPanel panel = new StackPanel(); panel.Orientation = Orientation.Vertical; panel.Width = 125; panel.Height = Double.NaN; panel.Margin = new Thickness(5); panel.Children.Add(CreateImage(di.GetIcon()).ToWPFImage(32, 32)); TextBlock label = new TextBlock(); label.TextAlignment = TextAlignment.Center; label.Text = di.Name; panel.Children.Add(label); ListViewItem lvi = new ListViewItem(); lvi.Content = panel; lvi.Tag = di; return lvi; }