public DriverManager(Driver.OS_Type os_type) { this.os_type = os_type; this.Drivers = new Dictionary <int, Driver>(); this.Devices = new List <Device>(); this.comp_ready = false; }
private void buttonSave_Click(object sender, EventArgs e) { string name = textBoxName.Text; int version = (int)numericUpDownVersion.Value; Driver.OS_Type osType = (Driver.OS_Type)comboBoxOSType.SelectedValue; Device.DeviceType deviceType = (Device.DeviceType)comboBoxDeviceType.SelectedValue; if (string.IsNullOrWhiteSpace(name)) { MessageBox.Show("The driver must have a name", "Error", MessageBoxButtons.OK); } else if (version <= 0) { MessageBox.Show("The version of driver must be greater than zero", "Error", MessageBoxButtons.OK); } else { driver.Name = name; driver.Version = version; driver.OSType = osType; driver.DeviceType = deviceType; Form1 main = this.Owner as Form1; main.update_drivers(); this.Hide(); } }
public void download_drivers() { Random rand = new Random(); for (int i = 0; i < rand.Next(1, 10); i++) { string name = ($"{ Guid.NewGuid()}"); int version = rand.Next(1, 100); Driver.OS_Type os_type = (Driver.OS_Type)rand.Next(1, 4); Device.DeviceType dev_type = (Device.DeviceType)rand.Next(1, 14); Driver driver = new Driver(name, version, os_type, dev_type); this.Drivers.Add(driver.GetHashCode(), driver); } }