Update to the new VM wizard, to check for a valid path in creating one.

svn path=/trunk/tools/RosTE/; revision=739
This commit is contained in:
Ziliang Guo 2008-06-01 01:22:57 +00:00
parent a9abec5dd1
commit fb8ce28317
2 changed files with 19 additions and 17 deletions

View File

@ -4,6 +4,7 @@ using System.ComponentModel;
using System.Data; using System.Data;
using System.Drawing; using System.Drawing;
using System.Text; using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms; using System.Windows.Forms;
using System.IO; using System.IO;
@ -81,9 +82,9 @@ namespace RosTEGUI
private void wizardDefaultDirPage_CloseFromNext(object sender, Gui.Wizard.PageEventArgs e) private void wizardDefaultDirPage_CloseFromNext(object sender, Gui.Wizard.PageEventArgs e)
{ {
if (defaultDirTxtBox.Text == "") if (!Directory.Exists(defaultDirTxtBox.Text))
{ {
MessageBox.Show("You must enter a name", "Error"); MessageBox.Show("You must enter a valid path", "Error");
e.Page = defaultDirInfoPage; e.Page = defaultDirInfoPage;
} }
} }
@ -147,22 +148,22 @@ namespace RosTEGUI
private void wizardHardDiskPage_Enter(object sender, EventArgs e) private void wizardHardDiskPage_Enter(object sender, EventArgs e)
{ {
DriveInfo di = new DriveInfo(defaultDirTxtBox.Text); DriveInfo di = new DriveInfo(defaultDirTxtBox.Text);
long AvailInMB = di.AvailableFreeSpace / (long)Math.Pow(1024, 2); long AvailInMB = di.AvailableFreeSpace / (long)Math.Pow(1024, 2);
if (AvailInMB > 20480) AvailInMB = 20480; if (AvailInMB > 20480) AvailInMB = 20480;
harddiskTrkBar.Minimum = 100; harddiskTrkBar.Minimum = 100;
harddiskTrkBar.Maximum = Convert.ToInt32(AvailInMB); harddiskTrkBar.Maximum = Convert.ToInt32(AvailInMB);
harddiskTrkBar.SmallChange = 100; harddiskTrkBar.SmallChange = 100;
harddiskTrkBar.TickFrequency = 50; harddiskTrkBar.TickFrequency = 50;
harddiskUpDwn.Minimum = 100; harddiskUpDwn.Minimum = 100;
harddiskUpDwn.Maximum = harddiskTrkBar.Maximum; harddiskUpDwn.Maximum = harddiskTrkBar.Maximum;
harddiskUpDwn.Increment = 100; harddiskUpDwn.Increment = 100;
harddiskDiskLab.Text = di.Name; harddiskDiskLab.Text = di.Name;
harddiskDiskSizeLab.Text = Convert.ToString(AvailInMB) + " MB"; harddiskDiskSizeLab.Text = Convert.ToString(AvailInMB) + " MB";
harddiskRecMinLab.Text = "100 MB"; harddiskRecMinLab.Text = "100 MB";
} }
private void wizardMemoryPage_Enter(object sender, EventArgs e) private void wizardMemoryPage_Enter(object sender, EventArgs e)
@ -225,7 +226,8 @@ namespace RosTEGUI
private void defaultDirInfoPage_Enter(object sender, EventArgs e) private void defaultDirInfoPage_Enter(object sender, EventArgs e)
{ {
defaultDirTxtBox.Text = mainConf.DefVmPath + '\\' + VMName; if(mainConf.DefVmPath != null && mainConf.DefVmPath != "")
defaultDirTxtBox.Text = mainConf.DefVmPath + '\\' + VMName;
} }
} }
} }

View File

@ -1,7 +1,7 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
// Runtime Version:2.0.50727.312 // Runtime Version:2.0.50727.1433
// //
// Changes to this file may cause incorrect behavior and will be lost if // Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. // the code is regenerated.