diff --git a/windows/QMK Toolbox/Form1.Designer.cs b/windows/QMK Toolbox/Form1.Designer.cs index 66c2370f8a..4330eac953 100644 --- a/windows/QMK Toolbox/Form1.Designer.cs +++ b/windows/QMK Toolbox/Form1.Designer.cs @@ -56,7 +56,7 @@ private void InitializeComponent() { this.button1.Location = new System.Drawing.Point(633, 11); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(54, 23); - this.button1.TabIndex = 3; + this.button1.TabIndex = 6; this.button1.Tag = "Erase, flash, and reset the MCU with the provided .hex file"; this.button1.Text = "Flash"; this.button1.Click += new System.EventHandler(this.FlashButton_Click); @@ -71,7 +71,7 @@ private void InitializeComponent() { this.checkBox1.Location = new System.Drawing.Point(589, 14); this.checkBox1.Name = "checkBox1"; this.checkBox1.Size = new System.Drawing.Size(47, 17); - this.checkBox1.TabIndex = 4; + this.checkBox1.TabIndex = 5; this.checkBox1.Tag = "Automatically flash when a device is detected in DFU mode"; this.checkBox1.Text = "auto"; this.checkBox1.UseVisualStyleBackColor = false; @@ -92,12 +92,13 @@ private void InitializeComponent() { this.richTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None; this.richTextBox1.Font = new System.Drawing.Font("Courier Prime", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.richTextBox1.ForeColor = System.Drawing.Color.White; + this.richTextBox1.HideSelection = false; this.richTextBox1.Location = new System.Drawing.Point(12, 40); this.richTextBox1.Name = "richTextBox1"; this.richTextBox1.ReadOnly = true; this.richTextBox1.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical; this.richTextBox1.Size = new System.Drawing.Size(729, 336); - this.richTextBox1.TabIndex = 5; + this.richTextBox1.TabIndex = 1; this.richTextBox1.Text = ""; this.richTextBox1.TextChanged += new System.EventHandler(this.richTextBox1_TextChanged); // @@ -106,7 +107,7 @@ private void InitializeComponent() { this.button2.Location = new System.Drawing.Point(439, 11); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(44, 23); - this.button2.TabIndex = 6; + this.button2.TabIndex = 3; this.button2.Tag = "Select a file from explorer"; this.button2.Text = "Open"; this.button2.UseVisualStyleBackColor = true; @@ -159,7 +160,7 @@ private void InitializeComponent() { this.comboBox3.Location = new System.Drawing.Point(506, 45); this.comboBox3.Name = "comboBox3"; this.comboBox3.Size = new System.Drawing.Size(64, 22); - this.comboBox3.TabIndex = 12; + this.comboBox3.TabIndex = 11; this.comboBox3.Tag = "The Vendor ID of your MCU in application mode"; this.comboBox3.Text = global::QMK_Toolbox.Properties.Settings.Default.vendorSetting; this.comboBox3.SelectedIndexChanged += new System.EventHandler(this.comboBox3_SelectedIndexChanged); @@ -181,7 +182,7 @@ private void InitializeComponent() { this.comboBox2.Location = new System.Drawing.Point(660, 46); this.comboBox2.Name = "comboBox2"; this.comboBox2.Size = new System.Drawing.Size(63, 22); - this.comboBox2.TabIndex = 13; + this.comboBox2.TabIndex = 12; this.comboBox2.Tag = "The Product ID of your MCU in application mode"; this.comboBox2.Text = global::QMK_Toolbox.Properties.Settings.Default.productSetting; this.comboBox2.SelectedIndexChanged += new System.EventHandler(this.comboBox3_SelectedIndexChanged); @@ -263,7 +264,7 @@ private void InitializeComponent() { this.radioButton2.Location = new System.Drawing.Point(16, 46); this.radioButton2.Name = "radioButton2"; this.radioButton2.Size = new System.Drawing.Size(89, 17); - this.radioButton2.TabIndex = 13; + this.radioButton2.TabIndex = 10; this.radioButton2.TabStop = true; this.radioButton2.Tag = "Use the Vendor and Product ID to the right as the HID console source"; this.radioButton2.Text = "Static Device"; @@ -279,7 +280,7 @@ private void InitializeComponent() { this.radioButton1.Location = new System.Drawing.Point(16, 20); this.radioButton1.Name = "radioButton1"; this.radioButton1.Size = new System.Drawing.Size(105, 17); - this.radioButton1.TabIndex = 9; + this.radioButton1.TabIndex = 8; this.radioButton1.Tag = "Currently unimplemented - will let you select from a list of available (connected" + ") devices"; this.radioButton1.Text = "Available Device"; @@ -297,7 +298,7 @@ private void InitializeComponent() { this.comboBox1.Location = new System.Drawing.Point(288, 19); this.comboBox1.Name = "comboBox1"; this.comboBox1.Size = new System.Drawing.Size(435, 21); - this.comboBox1.TabIndex = 8; + this.comboBox1.TabIndex = 9; this.comboBox1.Tag = "Currently unimplemented - will let you select from a list of available (connected" + ") devices"; this.comboBox1.MouseEnter += new System.EventHandler(this.btn_MouseEnter); @@ -333,7 +334,7 @@ private void InitializeComponent() { this.targetBox.Location = new System.Drawing.Point(489, 12); this.targetBox.Name = "targetBox"; this.targetBox.Size = new System.Drawing.Size(94, 21); - this.targetBox.TabIndex = 2; + this.targetBox.TabIndex = 4; this.targetBox.Tag = "The target (MCU) of the flashing"; this.targetBox.Text = global::QMK_Toolbox.Properties.Settings.Default.targetSetting; this.targetBox.MouseEnter += new System.EventHandler(this.btn_MouseEnter); @@ -346,8 +347,8 @@ private void InitializeComponent() { this.hexFileBox.Location = new System.Drawing.Point(12, 12); this.hexFileBox.Name = "hexFileBox"; this.hexFileBox.Size = new System.Drawing.Size(420, 21); - this.hexFileBox.TabIndex = 1; - this.hexFileBox.Tag = "Path for your .hex file"; + this.hexFileBox.TabIndex = 2; + this.hexFileBox.Tag = "The path for your .hex file"; this.hexFileBox.Text = global::QMK_Toolbox.Properties.Settings.Default.hexFileSetting; this.hexFileBox.MouseEnter += new System.EventHandler(this.btn_MouseEnter); this.hexFileBox.MouseHover += new System.EventHandler(this.btn_MouseLeave); diff --git a/windows/QMK Toolbox/Form1.cs b/windows/QMK Toolbox/Form1.cs index 6912c44d55..7d112e5107 100644 --- a/windows/QMK Toolbox/Form1.cs +++ b/windows/QMK Toolbox/Form1.cs @@ -63,13 +63,13 @@ private void Form1_Load(object sender, EventArgs e) { backgroundWorker1.RunWorkerAsync(); - richTextBox1.VisibleChanged += (sender1, e1) => - { - if (richTextBox1.Visible) { - richTextBox1.SelectionStart = richTextBox1.TextLength; - richTextBox1.ScrollToCaret(); - } - }; + //richTextBox1.VisibleChanged += (sender1, e1) => + //{ + // if (richTextBox1.Visible) { + // richTextBox1.SelectionStart = richTextBox1.TextLength; + // richTextBox1.ScrollToCaret(); + // } + //}; string dfuPath = Application.LocalUserAppDataPath + "\\dfu-programmer.exe"; ExtractResource("QMK_Toolbox.dfu-programmer.exe", dfuPath); @@ -111,7 +111,7 @@ private void Form1_Load(object sender, EventArgs e) { foreach (var device in collection) { var match = Regex.Match(device.GetPropertyValue("DeviceID").ToString(), @".*VID_03EB.*"); if (match.Success) { - Print("*** Device connected: " + device.GetPropertyValue("Name") + "\n", true, Color.Yellow); + Print("*** DFU Device connected: " + device.GetPropertyValue("Name") + "\n", true, Color.Yellow); } else { //Print("*** Device connected: " + device.GetPropertyValue("Name") + "\n", true); } @@ -139,22 +139,22 @@ private bool Connect() { _device.MonitorDeviceEvents = true; _isAttached = true; - Print("*** HID device available\n", true, Color.Yellow); + Print("*** HID device available: " + string.Format("0x{0:X4}", VendorId) + ":" + string.Format("0x{0:X4}", ProductId) + "\n", true, Color.DeepSkyBlue); } else { - Print("*** No HID device available\n", true, Color.Yellow); + Print("*** No HID device available\n", true, Color.DeepSkyBlue); _isAttached = false; } return _isAttached; } private void DeviceAttachedHandler() { - Print("*** HID device attached\n", true, Color.Yellow); + Print("*** HID device attached: " + string.Format("0x{0:X4}", VendorId) + ":" + string.Format("0x{0:X4}", ProductId) + "\n", true, Color.DeepSkyBlue); _isAttached = true; _device.ReadReport(OnReport); } private void DeviceRemovedHandler() { - Print("*** HID device detached\n", true, Color.Yellow); + Print("*** HID device detached: " + string.Format("0x{0:X4}", VendorId) + ":" + string.Format("0x{0:X4}", ProductId) + "\n", true, Color.DeepSkyBlue); _isAttached = false; } @@ -192,7 +192,7 @@ private void FlashButton_Click(object sender, EventArgs e) { if (targetBox.Text == "") { Print("*** Please select an MCU\n", true, Color.Red); } else if (hexFile == "") { - Print("*** Please select a file\n", true, Color.Red); + Print("*** Please select a .hex file\n", true, Color.Red); RunDFU("reset"); } else { if (mcuIsAvailable()) { @@ -210,7 +210,8 @@ private void Print(string str, bool bold = false, Color? color = null) { if (bold) richTextBox1.SelectionFont = new Font(richTextBox1.Font, FontStyle.Bold); richTextBox1.SelectionColor = color ?? Color.White; - richTextBox1.AppendText(str); + richTextBox1.SelectionStart = richTextBox1.TextLength; + richTextBox1.SelectedText = str; } else { this.Invoke(new Action(Print), new object[] { str, bold, color }); } @@ -235,7 +236,7 @@ private bool mcuIsAvailable() { output += process.StandardError.ReadToEnd(); process.WaitForExit(); if (output.Contains("no device present")) { - Print("*** No device present\n", true, Color.Red); + Print("*** No \""+ targetBox.Text + "\" DFU device connected\n", true, Color.Red); return false; } else { return true; @@ -263,7 +264,7 @@ private void DeviceInsertedEvent(object sender, EventArrivedEventArgs e) { // Detects Atmel Vendor ID var match = Regex.Match(instance.GetPropertyValue("DeviceID").ToString(), @".*VID_03EB.*"); if (match.Success) { - Print("*** Device inserted: " + instance.GetPropertyValue("Name") + "\n", true, Color.Yellow); + Print("*** DFU device connected: " + instance.GetPropertyValue("Name") + "\n", true, Color.Yellow); if (checkBox1.Checked) { FlashButton_Click(sender, e); } @@ -281,7 +282,7 @@ private void DeviceRemovedEvent(object sender, EventArrivedEventArgs e) { // Detects Atmel Vendor ID var match = Regex.Match(instance.GetPropertyValue("DeviceID").ToString(), @".*VID_03EB.*"); if (match.Success) { - Print("*** Device removed: " + instance.GetPropertyValue("Name") + "\n", true, Color.Yellow); + Print("*** DFU Device disconnected: " + instance.GetPropertyValue("Name") + "\n", true, Color.Yellow); } }