//Runs on window open public DriveScanWindow() { InitializeComponent(); //Get selected theme from config handler ThemeSwitch(ConfigHandler.readValue("theme")); HiddenFiles.IsChecked = Convert.ToBoolean(Convert.ToInt16(ConfigHandler.readValue("hidden"))); //Singleton Init currentWindow = this; //Populate Drive List RefreshDrives(this, null); //Define Label Formatting PointLabel = chartPoint => FormatSizeConverter.Convert((long)chartPoint.Y).ToString(); //Bind binding to labelpoint pointLabelBinding.Source = PointLabel; //Init scanned Drives list scannedDrives = new ObservableCollection <FolderInfo>(); //Populate Dir Tree DirectoryTree.ItemsSource = scannedDrives; }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { DriveInfo driveInfo = value as DriveInfo; long usedBytes; try { usedBytes = driveInfo.TotalSize - driveInfo.TotalFreeSpace; } catch (System.Exception) { usedBytes = 0; } return(FormatSizeConverter.Convert(usedBytes)); }