Ejemplo n.º 1
0
        private void EditMacro()
        {
            if (listViewMacro.SelectedItems.Count != 1)
            {
                return;
            }

            try
            {
                string command  = listViewMacro.SelectedItems[0].Text;
                string fileName = Path.Combine(MPControlPlugin.FolderMacros, command + IrssUtils.Common.FileExtensionMacro);

                if (File.Exists(fileName))
                {
                    MacroEditor macroEditor = new MacroEditor(command);
                    macroEditor.ShowDialog(this);
                }
                else
                {
                    RefreshMacroList();
                    RefreshEventMapperCommands();

                    throw new FileNotFoundException("Macro file missing", fileName);
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                MessageBox.Show(this, ex.Message, "Failed to edit macro", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 2
0
        private void buttonNewMacro_Click(object sender, EventArgs e)
        {
            MacroEditor macroEditor = new MacroEditor();

            macroEditor.ShowDialog(this);

            RefreshMacroList();
            RefreshEventMapperCommands();
        }