示例#1
0
        private void btnNewMacroSet_Click(object sender, EventArgs e)
        {
            MacroSet     newMacroSet = new MacroSet();
            MacroSetForm setForm     = new MacroSetForm(newMacroSet);

            var result = setForm.ShowDialog();

            //if result is ok, update all

            if (result == DialogResult.Cancel)
            {
                return;
            }

            DataContext.Instance.MacroSets.Add(newMacroSet);
            var success = DataContext.Instance.SaveData();

            if (success)
            {
                success = DataContext.Instance.ReloadData();
            }
            if (!success)
            {
                MessageBox.Show(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments));
            }

            RefreshBindings();
        }
示例#2
0
        private void btnRenameMacroSet_Click(object sender, EventArgs e)
        {
            if (DataContext.Instance.SelectedMacroSet.Name == null)
            {
                return;
            }

            MacroSetForm setForm = new MacroSetForm(DataContext.Instance.SelectedMacroSet);

            var result = setForm.ShowDialog();

            //if result is ok, update all

            if (result == DialogResult.Cancel)
            {
                return;
            }

            DataContext.Instance.SaveData();
            RefreshBindings();
        }