Пример #1
0
 private void updateResult()
 {
     if (txtButton.Text.Length > 0)
     {
         this.result = new ShortcutInfo(chkAlt.Checked, chkCtrl.Checked, chkShift.Checked, txtButton.Text[0]);
     }
 }
Пример #2
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();
        }
Пример #3
0
 private void ChangeHotkeyForm_Load(object sender, EventArgs e)
 {
     this.result = new ShortcutInfo();
 }
Пример #4
0
        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);
            }
        }
Пример #5
0
        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;
        }