Subversion Repositories Code-Repo

Compare Revisions

Ignore whitespace Rev 15 → Rev 16

/SWAT USB App/trunk/SWAT USB App/form_Drivers.cs
32,39 → 32,70
}
public form_Drivers()
{
this.Load += new EventHandler(form_Drivers_Load);
InitializeComponent();
}
 
void form_Drivers_Load(object sender, EventArgs e)
{
try
{
DebugText.appendText("Driver form initializing");
// Draws the form with a radiobutton for each driver specified in the text file
InitializeComponent();
// Location placeholder
int nextXLocation = 6, nextYLocation = 19;
// Updates the groupbox size to hold all the radiobuttons
this.groupBox_DriverList.Size = new Size(149, 40 + (driverList.Count - 1) * 23);
// Updates the window size to hold all the radiobuttons + buttons
this.Size = new Size(180, 121 + (driverList.Count - 1) * 23);
formRadioButton.Clear();
// Adds a radiobutton for each software item, adds rdoBtn to list formRadioButton
foreach (string str in driverList)
if (driverList.Count == 0)
{
RadioButton rdoBtn = new RadioButton();
rdoBtn.Name = "rdo_" + str;
rdoBtn.AutoSize = true;
// Removes the brackets from the name
rdoBtn.Text = str;
rdoBtn.Location = new Point(nextXLocation, nextYLocation);
// Increments the location placeholder for the next radiobutton
nextYLocation += 23;
this.groupBox_DriverList.Controls.Add(rdoBtn);
formRadioButton.Add(rdoBtn);
DebugText.appendText("No drivers were found in USBSettings.xml");
MessageBox.Show("No drivers were found in USBSettings.xml");
this.Close();
}
if (driverList.Count > 0)
formRadioButton[0].Checked = true;
else
{
bool modelFound = false;
DebugText.appendText("Driver form initializing");
Initialization.GetModelNumber();
// Draws the form with a radiobutton for each driver specified in the text file
// Location placeholder
int nextXLocation = 6, nextYLocation = 19;
// Updates the groupbox size to hold all the radiobuttons
this.groupBox_DriverList.Size = new Size(149, 40 + (driverList.Count - 1) * 23);
// Updates the window size to hold all the radiobuttons + buttons
this.Size = new Size(180, 121 + (driverList.Count - 1) * 23);
formRadioButton.Clear();
// Adds a radiobutton for each software item, adds rdoBtn to list formRadioButton
foreach (string str in driverList)
{
RadioButton rdoBtn = new RadioButton();
rdoBtn.Name = "rdo_" + str;
rdoBtn.AutoSize = true;
// Removes the brackets from the name
rdoBtn.Text = str;
rdoBtn.Location = new Point(nextXLocation, nextYLocation);
// Increments the location placeholder for the next radiobutton
nextYLocation += 23;
this.groupBox_DriverList.Controls.Add(rdoBtn);
formRadioButton.Add(rdoBtn);
// If model is detected, check the correct entry
if (str.ToLower() == Initialization.computerModel.ToLower() && modelFound == false)
{
modelFound = true;
rdoBtn.Checked = true;
}
}
if (modelFound == true)
{
MessageBox.Show("Drivers were found for this computer.\n" +
"Press OK to continue then OK to install drivers.");
}
else
{
MessageBox.Show("Drivers were not found for this computer.\n" +
"Please go to the manufacturer's site and manually\n" +
"download the drivers for this computer.");
}
}
}
catch (Exception e)
catch (Exception ex)
{
DebugText.appendText("Exception Thrown: " + e.ToString());
MessageBox.Show(e.ToString());
MessageBox.Show(ex.ToString());
}
}
private void updateToInstallList()