/// <summary> /// Enables/disables buttons /// </summary> /// <param name="actionType">Action type</param> /// <param name="buttons">Buttons</param> public static void EnableDisableButtons(this Diagram.UI.Interfaces.ActionType actionType, ToolStripButton[][] buttons) { if (actionType == Diagram.UI.Interfaces.ActionType.Start | actionType == ActionType.Resume) { buttons[0].SetEnabled(false); buttons[1].SetEnabled(true); if (buttons.Length > 2) { buttons[2].SetEnabled(true); } return; } if (actionType == Diagram.UI.Interfaces.ActionType.Stop) { buttons[0].SetEnabled(true); buttons[1].SetEnabled(false); if (buttons.Length > 2) { buttons[2].SetEnabled(false); } return; } if (actionType == ActionType.Pause) { buttons[0].SetEnabled(true); buttons[1].SetEnabled(true); if (buttons.Length > 2) { buttons[2].SetEnabled(false); } return; } }
void IStartStop.Action(object type, Diagram.UI.Interfaces.ActionType actionType) { this.actionType = actionType; if (form == null) { return; } if (form.IsDisposed) { return; } IStartStop ss = form; ss.Action(type, actionType); }
private void Act(object type, Diagram.UI.Interfaces.ActionType actionType) { if (IsDisposed) { return; } actionType.EnableDisableButtons(startStopPauseButtons); if (actionType == Diagram.UI.Interfaces.ActionType.Start) { if (type != null) { toolStripButtonPause.Enabled = false; toolStripStart.Enabled = false; toolStripStop.Enabled = false; } } }
void IStartStop.Action(object type, Diagram.UI.Interfaces.ActionType actionType) { this.actionType = actionType; this.InvokeIfNeeded <object, Diagram.UI.Interfaces.ActionType>(Act, type, actionType); }