Esempio n. 1
0
        /// <summary>
        /// Displays Change Pause dialog and 
        /// returns WaitMacroCommand object with specified pause or null.
        /// </summary>
        public static WaitMacroCommand PromptUser(int pause)
        {
            WaitMacroCommand cmd = null;

            using (ChangePauseDialog dlg = new ChangePauseDialog()) {
                dlg.Pause = pause;
                if (dlg.ShowDialog() == DialogResult.OK) {
                    cmd = new WaitMacroCommand();
                    cmd.Pause = dlg.Pause;
                }
            }

            return cmd;
        }
Esempio n. 2
0
        /// <summary>
        /// Displays Change Pause dialog and
        /// returns WaitMacroCommand object with specified pause or null.
        /// </summary>
        public static WaitMacroCommand PromptUser(int pause)
        {
            WaitMacroCommand cmd = null;

            using (ChangePauseDialog dlg = new ChangePauseDialog()) {
                dlg.Pause = pause;
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    cmd       = new WaitMacroCommand();
                    cmd.Pause = dlg.Pause;
                }
            }

            return(cmd);
        }
Esempio n. 3
0
        void insertWaitMenu_Click(object sender, EventArgs e)
        {
            if (commandList != null)
            {
                lock (commandList.SyncRoot) {
                    for (int i = table.SelectedIndicies.Length - 1; i >= 0; i--)
                    {
                        WaitMacroCommand cmd = WaitMacroCommand.PromptUser(500);

                        if (cmd != null)
                        {
                            Macro.Insert(table.SelectedIndicies[i], cmd);
                        }
                    }
                }
            }
        }
Esempio n. 4
0
        public void InsertCommand(int index, IMacroCommand command)
        {
            lock (commands.SyncRoot) {
                if (index >= 0)
                {
                    // Insert item
                    commands.Insert(index++, command);

                    if (pause > 0 && command.CommandType == MacroCommandType.Active)
                    {
                        IMacroCommand waitCmd = new WaitMacroCommand(pause);

                        if (index >= 0)
                        {
                            commands.Insert(index, waitCmd);
                        }
                        else
                        {
                            commands.Add(waitCmd);
                        }
                    }
                }
                else
                {
                    // Add item
                    if (pendingPause && pause > 0)
                    {
                        IMacroCommand waitCmd = new WaitMacroCommand(pause);
                        commands.Add(waitCmd);
                        pendingPause = false;
                    }

                    commands.Add(command);

                    if (command.CommandType == MacroCommandType.Active)
                    {
                        pendingPause = true;
                    }
                }
            }
        }
Esempio n. 5
0
        public void InsertCommand(int index, IMacroCommand command)
        {
            lock (commands.SyncRoot) {
                if (index >= 0) {
                    // Insert item
                    commands.Insert(index++, command);

                    if (pause > 0 && command.CommandType == MacroCommandType.Active) {
                        IMacroCommand waitCmd = new WaitMacroCommand(pause);

                        if (index >= 0)
                            commands.Insert(index, waitCmd);
                        else
                            commands.Add(waitCmd);
                    }
                }
                else {
                    // Add item
                    if (pendingPause && pause > 0) {
                        IMacroCommand waitCmd = new WaitMacroCommand(pause);
                        commands.Add(waitCmd);
                        pendingPause = false;
                    }

                    commands.Add(command);

                    if (command.CommandType == MacroCommandType.Active)
                        pendingPause = true;
                }
            }
        }