Subversion Repositories Code-Repo

Rev

Rev 10 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 10 Rev 16
Line 30... Line 30...
30
                return _driver_Form;
30
                return _driver_Form;
31
            }
31
            }
32
        }
32
        }
33
        public form_Drivers()
33
        public form_Drivers()
34
        {
34
        {
-
 
35
                this.Load += new EventHandler(form_Drivers_Load);
-
 
36
                InitializeComponent();
-
 
37
        }
-
 
38
 
-
 
39
        void form_Drivers_Load(object sender, EventArgs e)
-
 
40
        {
35
            try
41
            try
36
            {
42
            {
37
                DebugText.appendText("Driver form initializing");
-
 
38
                // Draws the form with a radiobutton for each driver specified in the text file
-
 
39
                InitializeComponent();
43
                if (driverList.Count == 0)
40
                // Location placeholder 
44
                {
41
                int nextXLocation = 6, nextYLocation = 19;
-
 
42
                // Updates the groupbox size to hold all the radiobuttons
45
                    DebugText.appendText("No drivers were found in USBSettings.xml");
43
                this.groupBox_DriverList.Size = new Size(149, 40 + (driverList.Count - 1) * 23);
-
 
44
                // Updates the window size to hold all the radiobuttons + buttons
46
                    MessageBox.Show("No drivers were found in USBSettings.xml");
45
                this.Size = new Size(180, 121 + (driverList.Count - 1) * 23);
47
                    this.Close();
46
                formRadioButton.Clear();
48
                }
47
                // Adds a radiobutton for each software item, adds rdoBtn to list formRadioButton
-
 
48
                foreach (string str in driverList)
49
                else
49
                {
50
                {
-
 
51
                    bool modelFound = false;
-
 
52
                    DebugText.appendText("Driver form initializing");
-
 
53
                    Initialization.GetModelNumber();
-
 
54
                    // Draws the form with a radiobutton for each driver specified in the text file
-
 
55
                    // Location placeholder 
-
 
56
                    int nextXLocation = 6, nextYLocation = 19;
-
 
57
                    // Updates the groupbox size to hold all the radiobuttons
-
 
58
                    this.groupBox_DriverList.Size = new Size(149, 40 + (driverList.Count - 1) * 23);
-
 
59
                    // Updates the window size to hold all the radiobuttons + buttons
-
 
60
                    this.Size = new Size(180, 121 + (driverList.Count - 1) * 23);
-
 
61
                    formRadioButton.Clear();
-
 
62
                    // Adds a radiobutton for each software item, adds rdoBtn to list formRadioButton
-
 
63
                    foreach (string str in driverList)
-
 
64
                    {
50
                    RadioButton rdoBtn = new RadioButton();
65
                        RadioButton rdoBtn = new RadioButton();
51
                    rdoBtn.Name = "rdo_" + str;
66
                        rdoBtn.Name = "rdo_" + str;
52
                    rdoBtn.AutoSize = true;
67
                        rdoBtn.AutoSize = true;
53
                    // Removes the brackets from the name
68
                        // Removes the brackets from the name
54
                    rdoBtn.Text = str;
69
                        rdoBtn.Text = str;
55
                    rdoBtn.Location = new Point(nextXLocation, nextYLocation);
70
                        rdoBtn.Location = new Point(nextXLocation, nextYLocation);
56
                    // Increments the location placeholder for the next radiobutton
71
                        // Increments the location placeholder for the next radiobutton
57
                    nextYLocation += 23;
72
                        nextYLocation += 23;
58
                    this.groupBox_DriverList.Controls.Add(rdoBtn);
73
                        this.groupBox_DriverList.Controls.Add(rdoBtn);
59
                    formRadioButton.Add(rdoBtn);
74
                        formRadioButton.Add(rdoBtn);
-
 
75
                        // If model is detected, check the correct entry
-
 
76
                        if (str.ToLower() == Initialization.computerModel.ToLower() && modelFound == false)
-
 
77
                        {
-
 
78
                            modelFound = true;
-
 
79
                            rdoBtn.Checked = true;
-
 
80
                        }
-
 
81
                    }
-
 
82
                    if (modelFound == true)
-
 
83
                    {
-
 
84
                        MessageBox.Show("Drivers were found for this computer.\n" +
-
 
85
                            "Press OK to continue then OK to install drivers.");
-
 
86
                    }
-
 
87
                    else
-
 
88
                    {
-
 
89
                        MessageBox.Show("Drivers were not found for this computer.\n" +
-
 
90
                            "Please go to the manufacturer's site and manually\n" +
-
 
91
                            "download the drivers for this computer.");
-
 
92
                    }
60
                }
93
                }
61
                if (driverList.Count > 0)
-
 
62
                    formRadioButton[0].Checked = true;
-
 
63
            }
94
            }
64
            catch (Exception e)
95
            catch (Exception ex)
65
            {
96
            {
66
                DebugText.appendText("Exception Thrown: " + e.ToString());
97
                DebugText.appendText("Exception Thrown: " + e.ToString());
67
                MessageBox.Show(e.ToString());
98
                MessageBox.Show(ex.ToString());
68
            }
99
            }
69
        }
100
        }
70
        private void updateToInstallList()
101
        private void updateToInstallList()
71
        {
102
        {
72
            try
103
            try