private void ChildWindow_Loaded(object sender, RoutedEventArgs e) { CurrentSetupState = SetupState.Default; LocalInstallTesting.Version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); long size = LocalInstallTesting.GetHardDiskFreeSpace(InstallPath.Substring(0, 1)); double gbSize = Convert.ToDouble(Convert.ToDouble(size) / 1024 / 1024 / 1024); if (gbSize >= 10) { ColorDisk = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF888888")); DiskSize = InstallPath.Substring(0, 1).ToUpper() + "盘可用空间:" + gbSize.ToString("f2") + "G"; } else { ColorDisk = new SolidColorBrush(Colors.Red); DiskSize = InstallPath.Substring(0, 1).ToUpper() + "盘可用空间:" + gbSize.ToString("f2") + "G(尽量选择剩余空间10G以上的盘符)"; } }
private void btnSelectFolder_Click(object sender, RoutedEventArgs e) { System.Windows.Forms.FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog(); dialog.SelectedPath = InstallPath; var result = dialog.ShowDialog(); string selectedPath = ""; if (dialog.SelectedPath.EndsWith("\\")) { selectedPath = dialog.SelectedPath.Substring(dialog.SelectedPath.Length - 3, 2); } else { selectedPath = dialog.SelectedPath; } if (result == System.Windows.Forms.DialogResult.OK) { if (!selectedPath.Contains("MusicTeachingWindow")) { InstallPath = selectedPath + @"\MusicTeachingWindow"; } } else { InstallPath = selectedPath; } long size = LocalInstallTesting.GetHardDiskFreeSpace(InstallPath.Substring(0, 1)); double gbSize = Convert.ToDouble(Convert.ToDouble(size) / 1024 / 1024 / 1024); if (gbSize >= 10) { ColorDisk = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF888888")); DiskSize = InstallPath.Substring(0, 1).ToUpper() + "盘可用空间:" + gbSize.ToString("f2") + "G"; } else { ColorDisk = new SolidColorBrush(Colors.Red); DiskSize = InstallPath.Substring(0, 1).ToUpper() + "盘可用空间:" + gbSize.ToString("f2") + "G(尽量选择剩余空间10G以上的盘符)"; } }