private void updateResult() { if (txtButton.Text.Length > 0) { this.result = new ShortcutInfo(chkAlt.Checked, chkCtrl.Checked, chkShift.Checked, txtButton.Text[0]); } }
public ChangeHotkeyForm(ShortcutInfo current) { result = current; InitializeComponent(); chkAlt.Checked = result.hasAlt(); chkShift.Checked = result.hasShift(); chkCtrl.Checked = result.hasCtrl(); txtButton.Text = ((char)result.KeyCode).ToString(); }
private void ChangeHotkeyForm_Load(object sender, EventArgs e) { this.result = new ShortcutInfo(); }
private void writeHotkey(ShortcutInfo value) { if (File.Exists(MainForm.hotkeyPath)) { File.Delete(MainForm.hotkeyPath); } using (var file = new System.IO.BinaryWriter(File.Open(MainForm.hotkeyPath, FileMode.OpenOrCreate))) { file.Write(value.Modifier); file.Write(value.KeyCode); } }
private ShortcutInfo readHotkey() { ShortcutInfo hotkey = new ShortcutInfo(); if (File.Exists(MainForm.hotkeyPath)) { using (var tr = new BinaryReader(File.Open(MainForm.hotkeyPath, FileMode.Open))) { hotkey.Modifier = tr.ReadUInt32(); hotkey.KeyCode = tr.ReadUInt32(); } } return hotkey; }