/// <summary>
        /// Shows the appropriate edit dialog for each setup instruction.
        /// </summary>
        /// <param name="currentVariables">Currently used variables (for use in textboxes)</param>
        /// <returns>true, if the user did not cancel</returns>
        public static bool ShowDialog(IWin32Window parent, SetupInstruction instruction, string[] currentVariables, ApplicationJob application)
        {
            InstructionBaseDialog dialog = null;

            if (instruction is StartProcessInstruction)
            {
                dialog = new StartProcessInstructionDialog();
            }
            else if (instruction is CopyFileInstruction)
            {
                dialog = new CopyFileInstructionDialog();
            }
            else if (instruction is CustomSetupInstruction)
            {
                dialog = new CustomSetupInstructionDialog();
            }
            else if (instruction is CloseProcessInstruction)
            {
                dialog = new CloseProcessInstructionDialog();
            }

            if (dialog != null)
            {
                dialog.Application      = application;
                dialog.SetupInstruction = instruction;
                dialog.VariableNames    = currentVariables;
                if (dialog.ShowDialog(parent) == DialogResult.OK)
                {
                    return(true);
                }
            }

            return(false);
        }
 private void EditInstruction()
 {
     if (InstructionBaseDialog.ShowDialog(this, this.instruction, this.VariableNames, this.instruction.Application))
     {
         UpdateFromInstruction(instruction);
     }
 }
Пример #3
0
        private void mnuCloseProcess_Click(object sender, EventArgs e)
        {
            CloseProcessInstruction instruction = new CloseProcessInstruction();

            instruction.Application = m_ApplicationJob;
            if (InstructionBaseDialog.ShowDialog(this, instruction, txtExecuteAfter.VariableNames, m_ApplicationJob))
            {
                SetupInstructionListBoxPanel panel = new SetupInstructionListBoxPanel(instruction);
                panel.VariableNames = txtExecuteAfter.VariableNames;
                instructionsListBox.Panels.Add(panel);
            }
        }
Пример #4
0
        private void mnuCustomCommand_Click(object sender, EventArgs e)
        {
            CustomSetupInstruction instruction = new CustomSetupInstruction();

            instruction.Application = this.m_ApplicationJob;
            if (InstructionBaseDialog.ShowDialog(this, instruction, this.txtExecuteAfter.VariableNames, this.m_ApplicationJob))
            {
                SetupInstructionListBoxPanel panel = new SetupInstructionListBoxPanel(instruction)
                {
                    VariableNames = this.txtExecuteAfter.VariableNames
                };
                this.instructionsListBox.Panels.Add(panel);
            }
        }