public SignalButtonState Copy() { SignalButtonState sigButState = (SignalButtonState)MemberwiseClone(); sigButState.ActiveSignal = ActiveSignal?.Copy(); sigButState.ButDef = ButDef?.Copy(); return(sigButState); }
///<summary>Sets the specified buttonIndex to a color and attaches the signal responsible. This is also used for the manual ack to increase responsiveness. buttonIndex is 0-based.</summary> public void SetButtonActive(int buttonIndex, Color color, SigMessage activeSigMessage) { if (!IsValidSigButState(buttonIndex)) { return; //no button to light up. } sigButStates[buttonIndex].CurrentColor = color; if (activeSigMessage == null) { sigButStates[buttonIndex].ActiveSignal = null; } else { sigButStates[buttonIndex].ActiveSignal = activeSigMessage.Copy(); } Invalidate(); }