Subversion Repositories Code-Repo

Rev

Rev 67 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 67 Rev 70
Line 18... Line 18...
18
        public Drivers_Form()
18
        public Drivers_Form()
19
        {
19
        {
20
            InitializeComponent();
20
            InitializeComponent();
21
            try
21
            try
22
            {
22
            {
-
 
23
                bool modelFound = false;
-
 
24
                Debug.appendText("Driver form initializing");
-
 
25
                if (SettingsParser.driverCheckForMatchingModel)
-
 
26
                    Initialization.GetModelNumber();
-
 
27
                // Draws the form with a radiobutton for each driver specified in the text file
-
 
28
                // Location placeholder 
-
 
29
                int nextXLocation = 6, nextYLocation = 19;
-
 
30
                // Updates the groupbox size to hold all the radiobuttons
-
 
31
                this.groupBox_DriverList.Size = new Size(SettingsParser.driverFormWidth - 31, 19 + SettingsParser.DriversList.Count() * 23);
-
 
32
                // Updates the window size to hold all the radiobuttons + buttons
-
 
33
                this.Size = new Size(SettingsParser.driverFormWidth, 101 + SettingsParser.DriversList.Count() * 23);
-
 
34
                formRadioButton.Clear();
-
 
35
                // Adds a radiobutton for each software item, adds rdoBtn to list formRadioButton
23
                if (SettingsParser.DriversList.Count() == 0)
36
                for (int i = 0; i < SettingsParser.DriversList.Count(); i++)
24
                {
37
                {
-
 
38
                    RadioButton rdoBtn = new RadioButton();
-
 
39
                    rdoBtn.Name = "rdo_" + SettingsParser.DriversList[i].Name;
-
 
40
                    rdoBtn.AutoSize = true;
-
 
41
                    // Removes the brackets from the name
25
                    Debug.appendText("No drivers were found in USBSettings.xml");
42
                    rdoBtn.Text = SettingsParser.DriversList[i].Name;
-
 
43
                    rdoBtn.Location = new Point(nextXLocation, nextYLocation);
-
 
44
                    // Increments the location placeholder for the next radiobutton
-
 
45
                    nextYLocation += 23;
-
 
46
                    this.groupBox_DriverList.Controls.Add(rdoBtn);
-
 
47
                    formRadioButton.Add(rdoBtn);
26
                    MessageBox.Show("No drivers were found in USBSettings.xml");
48
                    if (SettingsParser.driverCheckForMatchingModel)
-
 
49
                        // If model is detected, check the correct entry
-
 
50
                        if (SettingsParser.DriversList[i].Name.ToLower() == Initialization.computerModel.ToLower() && modelFound == false)
27
                    this.Close();
51
                        {
-
 
52
                            modelFound = true;
-
 
53
                            rdoBtn.Checked = true;
-
 
54
                        }
28
                }
55
                }
29
                else
56
                if (SettingsParser.driverCheckForMatchingModel)
30
                {
57
                {
31
                    bool modelFound = false;
58
                    if (modelFound == true)
32
                    Debug.appendText("Driver form initializing");
-
 
33
                    if (SettingsParser.driverCheckForMatchingModel)
-
 
34
                        Initialization.GetModelNumber();
-
 
35
                    // Draws the form with a radiobutton for each driver specified in the text file
-
 
36
                    // Location placeholder 
-
 
37
                    int nextXLocation = 6, nextYLocation = 19;
-
 
38
                    // Updates the groupbox size to hold all the radiobuttons
-
 
39
                    this.groupBox_DriverList.Size = new Size(SettingsParser.driverFormWidth - 31, 19 + SettingsParser.DriversList.Count() * 23);
-
 
40
                    // Updates the window size to hold all the radiobuttons + buttons
-
 
41
                    this.Size = new Size(SettingsParser.driverFormWidth, 101 + SettingsParser.DriversList.Count() * 23);
-
 
42
                    formRadioButton.Clear();
-
 
43
                    // Adds a radiobutton for each software item, adds rdoBtn to list formRadioButton
-
 
44
                    for (int i = 0; i < SettingsParser.DriversList.Count(); i++)
-
 
45
                    {
59
                    {
46
                        RadioButton rdoBtn = new RadioButton();
-
 
47
                        rdoBtn.Name = "rdo_" + SettingsParser.DriversList[i].Name;
-
 
48
                        rdoBtn.AutoSize = true;
-
 
49
                        // Removes the brackets from the name
-
 
50
                        rdoBtn.Text = SettingsParser.DriversList[i].Name;
-
 
51
                        rdoBtn.Location = new Point(nextXLocation, nextYLocation);
-
 
52
                        // Increments the location placeholder for the next radiobutton
-
 
53
                        nextYLocation += 23;
-
 
54
                        this.groupBox_DriverList.Controls.Add(rdoBtn);
60
                        MessageBox.Show("Drivers were found for this computer.\n" +
55
                        formRadioButton.Add(rdoBtn);
-
 
56
                        if (SettingsParser.driverCheckForMatchingModel)
-
 
57
                            // If model is detected, check the correct entry
61
                            "Press OK to continue then OK to install drivers.");
58
                            if (SettingsParser.DriversList[i].Name.ToLower() == Initialization.computerModel.ToLower() && modelFound == false)
-
 
59
                            {
-
 
60
                                modelFound = true;
-
 
61
                                rdoBtn.Checked = true;
-
 
62
                            }
-
 
63
                    }
62
                    }
64
                    if (SettingsParser.driverCheckForMatchingModel)
63
                    else
65
                    {
64
                    {
66
                        if (modelFound == true)
-
 
67
                        {
-
 
68
                            MessageBox.Show("Drivers were found for this computer.\n" +
-
 
69
                                "Press OK to continue then OK to install drivers.");
-
 
70
                        }
-
 
71
                        else
-
 
72
                        {
-
 
73
                            MessageBox.Show("Drivers were not found for this computer.\n" +
65
                        MessageBox.Show("Drivers were not found for this computer.\n" +
74
                                "Please go to the manufacturer's site and manually\n" +
66
                            "Please go to the manufacturer's site and manually\n" +
75
                                "download the drivers for this computer.");
67
                            "download the drivers for this computer.");
76
                        }
-
 
77
                    }
68
                    }
78
                }
69
                }
79
            }
70
            }
80
            catch (Exception ex)
71
            catch (Exception ex)
81
            {
72
            {