Subversion Repositories Code-Repo

Compare Revisions

No changes between revisions

Ignore whitespace Rev 69 → Rev 70

/SWAT Programs/SWAT USB App/trunk/SWAT USB App/Drivers_Form.cs
20,60 → 20,51
InitializeComponent();
try
{
if (SettingsParser.DriversList.Count() == 0)
bool modelFound = false;
Debug.appendText("Driver form initializing");
if (SettingsParser.driverCheckForMatchingModel)
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(SettingsParser.driverFormWidth - 31, 19 + SettingsParser.DriversList.Count() * 23);
// Updates the window size to hold all the radiobuttons + buttons
this.Size = new Size(SettingsParser.driverFormWidth, 101 + SettingsParser.DriversList.Count() * 23);
formRadioButton.Clear();
// Adds a radiobutton for each software item, adds rdoBtn to list formRadioButton
for (int i = 0; i < SettingsParser.DriversList.Count(); i++)
{
Debug.appendText("No drivers were found in USBSettings.xml");
MessageBox.Show("No drivers were found in USBSettings.xml");
this.Close();
RadioButton rdoBtn = new RadioButton();
rdoBtn.Name = "rdo_" + SettingsParser.DriversList[i].Name;
rdoBtn.AutoSize = true;
// Removes the brackets from the name
rdoBtn.Text = SettingsParser.DriversList[i].Name;
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 (SettingsParser.driverCheckForMatchingModel)
// If model is detected, check the correct entry
if (SettingsParser.DriversList[i].Name.ToLower() == Initialization.computerModel.ToLower() && modelFound == false)
{
modelFound = true;
rdoBtn.Checked = true;
}
}
else
if (SettingsParser.driverCheckForMatchingModel)
{
bool modelFound = false;
Debug.appendText("Driver form initializing");
if (SettingsParser.driverCheckForMatchingModel)
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(SettingsParser.driverFormWidth - 31, 19 + SettingsParser.DriversList.Count() * 23);
// Updates the window size to hold all the radiobuttons + buttons
this.Size = new Size(SettingsParser.driverFormWidth, 101 + SettingsParser.DriversList.Count() * 23);
formRadioButton.Clear();
// Adds a radiobutton for each software item, adds rdoBtn to list formRadioButton
for (int i = 0; i < SettingsParser.DriversList.Count(); i++)
if (modelFound == true)
{
RadioButton rdoBtn = new RadioButton();
rdoBtn.Name = "rdo_" + SettingsParser.DriversList[i].Name;
rdoBtn.AutoSize = true;
// Removes the brackets from the name
rdoBtn.Text = SettingsParser.DriversList[i].Name;
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 (SettingsParser.driverCheckForMatchingModel)
// If model is detected, check the correct entry
if (SettingsParser.DriversList[i].Name.ToLower() == Initialization.computerModel.ToLower() && modelFound == false)
{
modelFound = true;
rdoBtn.Checked = true;
}
MessageBox.Show("Drivers were found for this computer.\n" +
"Press OK to continue then OK to install drivers.");
}
if (SettingsParser.driverCheckForMatchingModel)
else
{
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.");
}
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.");
}
}
}
/SWAT Programs/SWAT USB App/trunk/SWAT USB App/Main_Menu_Form.Designer.cs
94,7 → 94,7
this.lbl_Main_Menu.TabIndex = 0;
this.lbl_Main_Menu.Text = "To begin, please select an option";
//
// form_Main_Menu
// Main_Menu_Form
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
104,7 → 104,7
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.Name = "form_Main_Menu";
this.Name = "Main_Menu_Form";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "SWAT USB Installer";
this.grp_Main_Menu.ResumeLayout(false);
/SWAT Programs/SWAT USB App/trunk/SWAT USB App/Main_Menu_Form.cs
28,21 → 28,39
MessageBox.Show("USBSettings.xml cannot be found.", "Error");
}
else
{
SettingsParser.readSettingsFile();
}
}
private void btn_Main_Drivers_Click(object sender, EventArgs e)
{
Drivers_Form driverForm = new Drivers_Form();
this.WindowState = FormWindowState.Minimized;
driverForm.ShowDialog();
this.WindowState = FormWindowState.Normal;
if (SettingsParser.DriversList.Count() == 0)
{
Debug.appendText("No drivers were found in USBSettings.xml or file does not exist");
MessageBox.Show("No drivers were found in USBSettings.xml or file does not exist");
}
else
{
Drivers_Form driverForm = new Drivers_Form();
//this.WindowState = FormWindowState.Minimized;
driverForm.ShowDialog();
//this.WindowState = FormWindowState.Normal;
}
}
private void btn_Main_Software_Click(object sender, EventArgs e)
{
Software_Form softwareForm = new Software_Form();
this.WindowState = FormWindowState.Minimized;
softwareForm.ShowDialog();
this.WindowState = FormWindowState.Normal;
if (SettingsParser.ApplicationsList.Count() == 0)
{
Debug.appendText("No drivers were found in USBSettings.xml or file does not exist");
MessageBox.Show("No drivers were found in USBSettings.xml or file does not exist");
}
else
{
Software_Form softwareForm = new Software_Form();
//this.WindowState = FormWindowState.Minimized;
softwareForm.ShowDialog();
//this.WindowState = FormWindowState.Normal;
}
}
private void btn_Main_Exit_Click(object sender, EventArgs e)
{
/SWAT Programs/SWAT USB App/trunk/SWAT USB App/Software_Form.cs
23,99 → 23,90
InitializeComponent();
try
{
if (SettingsParser.ApplicationsList.Count() == 0)
Debug.appendText("Software form initializing");
// Clears all lists
subGroups.Clear();
toInstall.Clear();
formCheckBoxes.Clear();
formRadioButton.Clear();
// Location placeholder
int nextXLocation = 6, nextYLocation = 19;
// Extracts all groups from ApplicationsList
for (int i = 0; i < SettingsParser.ApplicationsList.Count(); i++)
if (SettingsParser.ApplicationsList[i].Group != null)
{
// Check if group exists already
bool groupExist = false;
for (int j = 0; j < subGroups.Count(); j++)
if (SettingsParser.ApplicationsList[i].Group == subGroups[j])
{
groupExist = true;
break;
}
if (!groupExist)
subGroups.Add(SettingsParser.ApplicationsList[i].Group);
}
// Updates the groupbox size to hold all the checkboxes and subgroups
this.groupBox_SoftwareList.Size = new Size(SettingsParser.softwareFormWidth - 30, 19 + SettingsParser.ApplicationsList.Count() * 23 + (subGroups.Count() * 25));
// Updates the window size to hold all elements
this.Size = new Size(SettingsParser.softwareFormWidth, 101 + SettingsParser.ApplicationsList.Count() * 23 + (subGroups.Count() * 25));
// Adds a checkbox for each software item that is ungrouped, adds checkbox to list formCheckBoxes
for (int i = 0; i < SettingsParser.ApplicationsList.Count(); i++)
{
Debug.appendText("No software were found in USBSettings.xml");
MessageBox.Show("No software were found in USBSettings.xml");
this.Close();
if (SettingsParser.ApplicationsList[i].Group == null)
{
// Creates a new checkbox
CheckBox chkBox = new CheckBox();
chkBox.Name = "chk_" + SettingsParser.ApplicationsList[i].Name;
chkBox.AutoSize = true;
chkBox.Text = SettingsParser.ApplicationsList[i].Name;
if (SettingsParser.ApplicationsList[i].Default)
chkBox.Checked = true;
chkBox.Location = new Point(nextXLocation, nextYLocation);
// Increments the location placeholder for the next element
nextYLocation += 23;
// Adds the checkbox to the parent groupbox
this.groupBox_SoftwareList.Controls.Add(chkBox);
// Adds the checkbox to formCheckBoxes list
formCheckBoxes.Add(chkBox);
}
}
else
// Adds a groupbox for each entry specified in subGroups as well as any applications under the group
for (int i = 0; i < subGroups.Count(); i++)
{
Debug.appendText("Software form initializing");
// Clears all lists
subGroups.Clear();
toInstall.Clear();
formCheckBoxes.Clear();
formRadioButton.Clear();
// Location placeholder
int nextXLocation = 6, nextYLocation = 19;
// Extracts all groups from ApplicationsList
for (int i = 0; i < SettingsParser.ApplicationsList.Count(); i++)
if (SettingsParser.ApplicationsList[i].Group != null)
// Sets the internal location coordinates for the next element
int subNextXLocation = 6;
int subNextYLocation = 19;
// Creates a new groupbox
GroupBox grpBox = new GroupBox();
grpBox.Name = "grp_" + subGroups[i];
grpBox.Text = subGroups[i];
// Finds the number of applications under the group
int numberOfSubentries = 0;
for (int j = 0; j < SettingsParser.ApplicationsList.Count(); j++)
if (SettingsParser.ApplicationsList[j].Group == subGroups[i])
{
// Check if group exists already
bool groupExist = false;
for (int j = 0; j < subGroups.Count(); j++)
if (SettingsParser.ApplicationsList[i].Group == subGroups[j])
{
groupExist = true;
break;
}
if (!groupExist)
subGroups.Add(SettingsParser.ApplicationsList[i].Group);
}
// Updates the groupbox size to hold all the checkboxes and subgroups
this.groupBox_SoftwareList.Size = new Size(SettingsParser.softwareFormWidth - 30, 19 + SettingsParser.ApplicationsList.Count() * 23 + (subGroups.Count() * 25));
// Updates the window size to hold all elements
this.Size = new Size(SettingsParser.softwareFormWidth, 101 + SettingsParser.ApplicationsList.Count() * 23 + (subGroups.Count() * 25));
// Adds a checkbox for each software item that is ungrouped, adds checkbox to list formCheckBoxes
for (int i = 0; i < SettingsParser.ApplicationsList.Count(); i++)
{
if (SettingsParser.ApplicationsList[i].Group == null)
{
// Creates a new checkbox
CheckBox chkBox = new CheckBox();
chkBox.Name = "chk_" + SettingsParser.ApplicationsList[i].Name;
chkBox.AutoSize = true;
chkBox.Text = SettingsParser.ApplicationsList[i].Name;
if (SettingsParser.ApplicationsList[i].Default)
chkBox.Checked = true;
chkBox.Location = new Point(nextXLocation, nextYLocation);
// If the group matches, creates a new radiobutton
numberOfSubentries++;
RadioButton rdoBtn = new RadioButton();
rdoBtn.Name = "rdo_" + SettingsParser.ApplicationsList[j].Name;
rdoBtn.AutoSize = true;
rdoBtn.Text = SettingsParser.ApplicationsList[j].Name;
if (SettingsParser.ApplicationsList[j].Default)
rdoBtn.Checked = true;
rdoBtn.Location = new Point(subNextXLocation, subNextYLocation);
// Increments the location placeholder for the next element
nextYLocation += 23;
// Adds the checkbox to the parent groupbox
this.groupBox_SoftwareList.Controls.Add(chkBox);
// Adds the checkbox to formCheckBoxes list
formCheckBoxes.Add(chkBox);
subNextYLocation += 23;
// Adds the radiobutton to the parent groupbox
grpBox.Controls.Add(rdoBtn);
// Adds the radiobutton to formRadioButton list
formRadioButton.Add(rdoBtn);
}
}
// Adds a groupbox for each entry specified in subGroups as well as any applications under the group
for (int i = 0; i < subGroups.Count(); i++)
{
// Sets the internal location coordinates for the next element
int subNextXLocation = 6;
int subNextYLocation = 19;
// Creates a new groupbox
GroupBox grpBox = new GroupBox();
grpBox.Name = "grp_" + subGroups[i];
grpBox.Text = subGroups[i];
// Finds the number of applications under the group
int numberOfSubentries = 0;
for (int j = 0; j < SettingsParser.ApplicationsList.Count(); j++)
if (SettingsParser.ApplicationsList[j].Group == subGroups[i])
{
// If the group matches, creates a new radiobutton
numberOfSubentries++;
RadioButton rdoBtn = new RadioButton();
rdoBtn.Name = "rdo_" + SettingsParser.ApplicationsList[j].Name;
rdoBtn.AutoSize = true;
rdoBtn.Text = SettingsParser.ApplicationsList[j].Name;
if (SettingsParser.ApplicationsList[j].Default)
rdoBtn.Checked = true;
rdoBtn.Location = new Point(subNextXLocation, subNextYLocation);
// Increments the location placeholder for the next element
subNextYLocation += 23;
// Adds the radiobutton to the parent groupbox
grpBox.Controls.Add(rdoBtn);
// Adds the radiobutton to formRadioButton list
formRadioButton.Add(rdoBtn);
}
grpBox.Size = new Size(SettingsParser.softwareFormWidth - 42, 19 + numberOfSubentries * 23);
grpBox.Location = new Point(nextXLocation, nextYLocation);
nextYLocation += 25 + numberOfSubentries * 23;
// Adds the created groupbox to the parent groupbox
this.groupBox_SoftwareList.Controls.Add(grpBox);
}
grpBox.Size = new Size(SettingsParser.softwareFormWidth - 42, 19 + numberOfSubentries * 23);
grpBox.Location = new Point(nextXLocation, nextYLocation);
nextYLocation += 25 + numberOfSubentries * 23;
// Adds the created groupbox to the parent groupbox
this.groupBox_SoftwareList.Controls.Add(grpBox);
}
}
catch (Exception ex)
/SWAT Programs/SWAT USB App/trunk/SWAT USB App/bin/Debug/SWAT USB App.exe
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/SWAT Programs/SWAT USB App/trunk/SWAT USB App/bin/Release/SWAT USB App.exe
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/SWAT Programs/SWAT USB App/trunk/SWAT USB App.suo
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream