private void RaiseOutputEvent(ControlId controlId, float value) { var handler = OutputEvent; if (handler != null) { handler(this, new ControlEvent(controlId, value)); } }
public float GetOutputValue(ControlId controlId) { Guard.NotNull(controlId, nameof(controlId)); ControlState state; if (!_controls.TryGetValue(controlId, out state)) { return(0); } return(state.OutputValue); }
public void SetOutputValue(ControlId controlId, float value) { Guard.NotNull(controlId, nameof(controlId)); ControlState state; if (!_controls.TryGetValue(controlId, out state)) { state = new ControlState(); _controls.Add(controlId, state); } if (state.OutputValue == value) { return; } state.OutputValue = value; RaiseOutputEvent(controlId, value); }
public ControlEvent(ControlId controlId, float value) { ControlId = Guard.NotNull(controlId, nameof(controlId)); Value = value; }