Implement sequence mode
This commit is contained in:
@@ -7,7 +7,13 @@ using System.Windows.Forms;
|
||||
|
||||
namespace DD2Switcher {
|
||||
public partial class SettingsForm : Form {
|
||||
private TabControl tabControl;
|
||||
private TabPage windowsTab;
|
||||
private TabPage sequenceTab;
|
||||
private FlowLayoutPanel windowsPanel;
|
||||
private Label sequenceKeybindLabel;
|
||||
private TextBox sequenceKeybindTextBox;
|
||||
private Timer statusTimer;
|
||||
|
||||
public SettingsForm() {
|
||||
InitializeComponent();
|
||||
@@ -16,32 +22,95 @@ namespace DD2Switcher {
|
||||
}
|
||||
|
||||
private void InitializeComponent() {
|
||||
this.tabControl = new System.Windows.Forms.TabControl();
|
||||
this.windowsTab = new System.Windows.Forms.TabPage();
|
||||
this.windowsPanel = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.sequenceTab = new System.Windows.Forms.TabPage();
|
||||
this.sequenceKeybindTextBox = new System.Windows.Forms.TextBox();
|
||||
this.sequenceKeybindLabel = new System.Windows.Forms.Label();
|
||||
this.tabControl.SuspendLayout();
|
||||
this.windowsTab.SuspendLayout();
|
||||
this.sequenceTab.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// tabControl
|
||||
//
|
||||
this.tabControl.Controls.Add(this.windowsTab);
|
||||
this.tabControl.Controls.Add(this.sequenceTab);
|
||||
this.tabControl.Location = new System.Drawing.Point(12, 12);
|
||||
this.tabControl.Name = "tabControl";
|
||||
this.tabControl.SelectedIndex = 0;
|
||||
this.tabControl.Size = new System.Drawing.Size(576, 396);
|
||||
this.tabControl.TabIndex = 0;
|
||||
//
|
||||
// windowsTab
|
||||
//
|
||||
this.windowsTab.Controls.Add(this.windowsPanel);
|
||||
this.windowsTab.Location = new System.Drawing.Point(4, 22);
|
||||
this.windowsTab.Name = "windowsTab";
|
||||
this.windowsTab.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.windowsTab.Size = new System.Drawing.Size(568, 370);
|
||||
this.windowsTab.TabIndex = 0;
|
||||
this.windowsTab.Text = "Windows";
|
||||
this.windowsTab.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// windowsPanel
|
||||
//
|
||||
this.windowsPanel.AutoScroll = true;
|
||||
this.windowsPanel.BackColor = System.Drawing.Color.White;
|
||||
this.windowsPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.windowsPanel.Location = new System.Drawing.Point(12, 12);
|
||||
this.windowsPanel.Location = new System.Drawing.Point(6, 6);
|
||||
this.windowsPanel.Name = "windowsPanel";
|
||||
this.windowsPanel.Padding = new System.Windows.Forms.Padding(10);
|
||||
this.windowsPanel.Size = new System.Drawing.Size(576, 396);
|
||||
this.windowsPanel.TabIndex = 1;
|
||||
this.windowsPanel.Size = new System.Drawing.Size(556, 358);
|
||||
this.windowsPanel.TabIndex = 0;
|
||||
//
|
||||
// sequenceTab
|
||||
//
|
||||
this.sequenceTab.Controls.Add(this.sequenceKeybindTextBox);
|
||||
this.sequenceTab.Controls.Add(this.sequenceKeybindLabel);
|
||||
this.sequenceTab.Location = new System.Drawing.Point(4, 22);
|
||||
this.sequenceTab.Name = "sequenceTab";
|
||||
this.sequenceTab.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.sequenceTab.Size = new System.Drawing.Size(568, 370);
|
||||
this.sequenceTab.TabIndex = 1;
|
||||
this.sequenceTab.Text = "Sequence";
|
||||
this.sequenceTab.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// sequenceKeybindTextBox
|
||||
//
|
||||
this.sequenceKeybindTextBox.Location = new System.Drawing.Point(126, 17);
|
||||
this.sequenceKeybindTextBox.Name = "sequenceKeybindTextBox";
|
||||
this.sequenceKeybindTextBox.Size = new System.Drawing.Size(111, 20);
|
||||
this.sequenceKeybindTextBox.TabIndex = 1;
|
||||
this.sequenceKeybindTextBox.Text = "F1";
|
||||
this.sequenceKeybindTextBox.Leave += new System.EventHandler(this.sequenceKeybindTextBox_Leave);
|
||||
//
|
||||
// sequenceKeybindLabel
|
||||
//
|
||||
this.sequenceKeybindLabel.AutoSize = true;
|
||||
this.sequenceKeybindLabel.Location = new System.Drawing.Point(20, 20);
|
||||
this.sequenceKeybindLabel.Name = "sequenceKeybindLabel";
|
||||
this.sequenceKeybindLabel.Size = new System.Drawing.Size(100, 13);
|
||||
this.sequenceKeybindLabel.TabIndex = 0;
|
||||
this.sequenceKeybindLabel.Text = "Sequence Keybind:";
|
||||
//
|
||||
// SettingsForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(600, 420);
|
||||
this.Controls.Add(this.windowsPanel);
|
||||
this.Controls.Add(this.tabControl);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "SettingsForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "DD2Switcher Settings";
|
||||
this.tabControl.ResumeLayout(false);
|
||||
this.windowsTab.ResumeLayout(false);
|
||||
this.sequenceTab.ResumeLayout(false);
|
||||
this.sequenceTab.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
}
|
||||
|
||||
@@ -165,5 +234,15 @@ namespace DD2Switcher {
|
||||
// Use default icon if custom icon not found
|
||||
}
|
||||
}
|
||||
|
||||
private void sequenceKeybindTextBox_Leave(object sender, EventArgs e) {
|
||||
try {
|
||||
KeysConverter converter = new KeysConverter();
|
||||
Keys newKey = (Keys)converter.ConvertFromString(sequenceKeybindTextBox.Text);
|
||||
Program.UpdateSequenceHotkey(newKey);
|
||||
} catch {
|
||||
sequenceKeybindTextBox.Text = Program.SequenceKeybind.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user