/// <summary>
        /// Save the fields into the sequence object
        /// </summary>
        /// <returns>return false if validation failed</returns>
        private bool SaveHotKeySequence()
        {
            // disabled?
            if (ckHotKey.Checked == false)
            {
                this.Sequence = null;
                return true;
            }

            // verify
            string noneModiifer = WinAPI.KeyModifiers.None.ToString();
            if ((string)this.cbHotKeyMod1.SelectedItem == noneModiifer
                && (string)this.cbHotKeyMod2.SelectedItem == noneModiifer
                && (string)this.cbHotKeyMod3.SelectedItem == noneModiifer)
            {
                MessageBox.Show(this, "You must select at least one modifier (e.g. Alt, Ctrl or Shift)", "Auto Login", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return false;
            }
            if (this.cbHotKey.SelectedItem == null || (string)this.cbHotKey.SelectedItem == string.Empty)
            {
                MessageBox.Show(this, "You must select a hotkey", "Auto Login", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                this.cbHotKey.Focus();
                return false;
            }
            if (this.ckAdvanced.Checked == true && this.tbAdvanced.Text.Trim().Length == 0)
            {
                MessageBox.Show(this, "You must select enter some advanced key commands", "Auto Login", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                tbAdvanced.Focus();
                return false;
            }

            // enabled and craerte HoTKetSequence if necccessary
            HoyKeySequence sequence = this.Sequence ?? new HoyKeySequence();
            if (this.Sequence == null)
            {
                this.Sequence = sequence;
            }

            // get the modifiers
            WinAPI.KeyModifiers modifier = WinAPI.KeyModifiers.None;
            modifier |= FindModifier((string)cbHotKeyMod1.SelectedItem);
            modifier |= FindModifier((string)cbHotKeyMod2.SelectedItem);
            modifier |= FindModifier((string)cbHotKeyMod3.SelectedItem);
            sequence.Modifiers = modifier;

            // get the key
            string key = "VK_" + ((string)cbHotKey.SelectedItem);
            sequence.HotKey = (WinAPI.VirtualKeyCode)Enum.Parse(typeof(WinAPI.VirtualKeyCode), key, true);

            // get the title
            sequence.WindowTitle = this.tbWindowTitle.Text;
            sequence.WindowTitleRegex = this.ckRegex.Checked;
            sequence.ProcessName = this.tbProcessName.Text;

            // get the script
            sequence.Advanced = ckAdvanced.Checked;
            sequence.AdvancedScript = tbAdvanced.Text;

            return true;
        }
        public void HoyKeySequence_Load()
        {
            // all possible modifiers
            WinAPI.KeyModifiers[] modifiers = new WinAPI.KeyModifiers[]
            {
                WinAPI.KeyModifiers.None,
                WinAPI.KeyModifiers.Alt,
                WinAPI.KeyModifiers.Control,
                WinAPI.KeyModifiers.Shift,
                WinAPI.KeyModifiers.Alt | WinAPI.KeyModifiers.Control,
                WinAPI.KeyModifiers.Alt | WinAPI.KeyModifiers.Shift,
                WinAPI.KeyModifiers.Control | WinAPI.KeyModifiers.Shift,
                WinAPI.KeyModifiers.Alt | WinAPI.KeyModifiers.Control | WinAPI.KeyModifiers.Shift
            };

            // loop through each VKey
            foreach (WinAPI.KeyModifiers modifier in modifiers)
            {
                HoyKeySequence hk1 = new HoyKeySequence(null);
                hk1.Modifiers = modifier;
                hk1.Advanced = false;

                foreach (WinAPI.VirtualKeyCode vk in Enum.GetValues(typeof(WinAPI.VirtualKeyCode)))
                {
                    hk1.HotKey = vk;
                    string s1 = hk1.ToString();
                    HoyKeySequence hk2 = new HoyKeySequence(s1);
                    string s2 = hk2.ToString();
                    Console.Out.WriteLine(Convert.ToSingle(modifier) + ":" + Convert.ToString(vk));
                    Assert.AreEqual(s1, s2);
                }
            }
        }