Esempio n. 1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            ConfigAddForm addForm = new ConfigAddForm();

            addForm.ShowDialog();
            ConfigClass val = addForm.config;

            if (val == null)
            {
                return;
            }
            hotKeys.Add(val.getKeyPairs().GetHashCode(), val);
            addViewItem(val);
            btnApply.Enabled = true;
        }
Esempio n. 2
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            int           idx      = keysListView.SelectedItems[0].ImageIndex;
            ConfigAddForm editForm = new ConfigAddForm(hotKeys[idx]);

            editForm.ShowDialog();
            ConfigClass val = editForm.config;

            if (val == null)
            {
                return;
            }
            hotKeys.Remove(idx);
            hotKeys.Add(val.getKeyPairs().GetHashCode(), val);
            keysListView.Items.Remove(keysListView.SelectedItems[0]);
            addViewItem(val);
            btnApply.Enabled = true;
        }
Esempio n. 3
0
        public ConfigAddForm(ConfigClass _config) : this()
        {
            this.Text = "Edit Item";
            config    = _config;

            nameView.Text = config.getName();
            keysView.Text = string.Join("+", config.getKeyPairs());
            switch (config.getType())
            {
            case ConfigClass.CommandType.EXE:
            {
                typeView.SelectedIndex = 0;
                exeFileView.Text       = config.getExeFile();
                exeArgView.Text        = config.getExeArg();
                break;
            }

            case ConfigClass.CommandType.KEY:
            {
                typeView.SelectedIndex = 1;
                targetKeyView.Text     = config.getTargetKey().ToString();
                break;
            }

            case ConfigClass.CommandType.CMD:
            {
                typeView.SelectedIndex = 2;
                cmdLineView.Text       = config.getCmdLine();
                break;
            }

            default:
                break;
            }

            keysSaved = new KeyPair(_config.getKeyPairs());
        }
Esempio n. 4
0
 private void addViewItem(ConfigClass val)
 {
     keysListView.Items.Add(new ListViewItem(new[] { val.getName(), string.Join("+", val.getKeyPairs())
                                                     , val.getType().ToString()
                                                     , val.getType() == ConfigClass.CommandType.EXE ? val.getExeFile() + " " + val.getExeArg()
         :val.getType() == ConfigClass.CommandType.KEY ? val.getTargetKey().ToString() : val.getCmdLine() }, val.getKeyPairs().GetHashCode()));
 }