Try fix sequence mode

This commit is contained in:
2025-08-31 21:05:40 +02:00
parent 1cdfba0b14
commit 87bd2132e5
3 changed files with 159 additions and 12 deletions

View File

@@ -13,7 +13,6 @@ namespace DD2Switcher {
private FlowLayoutPanel windowsPanel;
private Label sequenceKeybindLabel;
private TextBox sequenceKeybindTextBox;
private Timer statusTimer;
public SettingsForm() {
InitializeComponent();
@@ -107,6 +106,7 @@ namespace DD2Switcher {
this.Name = "SettingsForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "DD2Switcher Settings";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.SettingsForm_FormClosing);
this.tabControl.ResumeLayout(false);
this.windowsTab.ResumeLayout(false);
this.sequenceTab.ResumeLayout(false);
@@ -236,13 +236,29 @@ namespace DD2Switcher {
}
private void sequenceKeybindTextBox_Leave(object sender, EventArgs e) {
Console.WriteLine($"sequenceKeybindTextBox_Leave called with text: {sequenceKeybindTextBox.Text}");
try {
KeysConverter converter = new KeysConverter();
Keys newKey = (Keys)converter.ConvertFromString(sequenceKeybindTextBox.Text);
Console.WriteLine($"Converted key: {newKey} (code: {(int)newKey})");
Program.UpdateSequenceHotkey(newKey);
} catch {
Console.WriteLine("Keybind updated successfully!");
} catch (Exception ex) {
Console.WriteLine($"Error converting key: {ex.Message}");
sequenceKeybindTextBox.Text = Program.SequenceKeybind.ToString();
}
}
private void SettingsForm_FormClosing(object sender, FormClosingEventArgs e) {
Console.WriteLine("SettingsForm closing - saving keybind");
try {
KeysConverter converter = new KeysConverter();
Keys newKey = (Keys)converter.ConvertFromString(sequenceKeybindTextBox.Text);
Console.WriteLine($"Saving keybind on close: {newKey}");
Program.UpdateSequenceHotkey(newKey);
} catch (Exception ex) {
Console.WriteLine($"Error saving keybind on close: {ex.Message}");
}
}
}
}