Example #1
0
 private void InitializeComponent()
 {
     _driverName = _installer.GetDriverNames();
     _driversBox = new GroupBox();
     _installBtn = new Button();
     SuspendLayout();
     _driversBox.Text      = "Install Drivers";
     _driversBox.FlatStyle = FlatStyle.Flat;
     _driversBox.Controls.Add(_installBtn);
     Controls.Add(_driversBox);
     _installer = new MiInstaller();
     component  = _installer.Container;
     //
     // driversBox
     //
     _driversBox.Controls.Add(_installBtn);
     _driversBox.Location = new Point(32, 26);
     _driversBox.Name     = "_driversBox";
     _driversBox.Size     = new Size(417, 266);
     _driversBox.TabIndex = 0;
     _driversBox.TabStop  = false;
     _driversBox.Text     = "Install Drivers";
     //
     // installBtn
     //
     _installBtn.Location = new Point(332, 233);
     _installBtn.Name     = "_installBtn";
     _installBtn.Size     = new Size(80, 27);
     _installBtn.TabIndex = 1;
     _installBtn.Text     = "Install";
     _installBtn.UseVisualStyleBackColor = true;
     _installBtn.Click += ConfirmInstall;
     //
     // driverNames
     //
     _driverListBox.DataSource = _driverName; // TODO fix exception
     //
     // Form1
     //
     AutoScaleMode = AutoScaleMode.Inherit;
     ClientSize    = new Size(489, 326);
     Controls.Add(_driversBox);
     Name = "Form1";
     Text = "Install Drivers";
     _driversBox.ResumeLayout(false);
     ResumeLayout(false);
     PerformLayout();
 }
Example #2
0
        public void ConvertArraytoList()
        {
            MiInstaller installer = new MiInstaller();

            String[] names = new string[5]
            {
                "Google\\Driver\\android_winusb.inf",
                "Nvidia\\Driver\\NvidiaUsb.inf",
                "Microsoft\\Driver\\tetherxp.inf",
                "Microsoft\\Driver\\wpdmtphw.inf",
                "Qualcomm\\Driver\\qcser.inf"
            };
            List <string> getNames, test = new List <string>();

            getNames = installer.GetDriverNames();
            foreach (var str in names)
            {
                test.Add(str);
            }
            Assert.True(Enumerable.SequenceEqual(test, getNames));
        }