protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { if (!IsTextBoxActive()) { if (StepManager.CurrentStep != null) { if (keyData == Keys.Up) { if (StepManager.CurrentStep.Iterations != -1) { StepManager.PrevIterationFromCurrentPos(); } else if (StepManager.CurrentStepIndex > 0) { StepManager.SetCurrentStepIndex(StepManager.CurrentStepIndex - 1); } return(true); } if (keyData == Keys.Down) { if (StepManager.CurrentStep.Iterations != -1) { StepManager.NextIterationFromCurrentPos(); } else if (StepManager.CurrentStepIndex < StepManager.Steps.Count - 1) { StepManager.SetCurrentStepIndex(StepManager.CurrentStepIndex + 1); } return(true); } if (keyData == Keys.Right) { if ((StepManager.CurrentStep.Iterations != -1) && (StepManager.CurrentStep.CompletedIterations != StepManager.CurrentStep.Iterations)) { StepManager.NextLoopFromCurrentPos(); } return(true); } if (keyData == Keys.Left) { if ((StepManager.CurrentStep.Iterations != -1) && (StepManager.CurrentStep.CompletedIterations != 0)) { StepManager.PrevLoopFromCurrentPos(); } return(true); } if (keyData == Keys.Delete) { if (StepManager.CurrentStepIndex != -1) { var removeFinal = StepManager.CurrentStep == StepManager.FinalStep; if (StepManager.TryToRemove(StepManager.CurrentStepIndex) && removeFinal) { StepManager.FinalStep = null; markAsFinalLabel.Text = "mark as final"; } } return(true); } } if (_hotkeys.ContainsKey(keyData)) { _hotkeys[keyData](); return(true); } } return(base.ProcessCmdKey(ref msg, keyData)); }