/// <summary> /// Method to use in place of SetComplete/SetFailed/SetIncomplete. Doesn't fire the stock change event because of /// performance issues with the stock contracts app. /// </summary> /// <param name="state">New parameter state</param> protected virtual void SetState(ParameterState state) { // State already set, or parameter disabled if (this.state == state || !enabled) { return; } // Check if the transition is allowed if (state == ParameterState.Complete && !ReadyToComplete()) { return; } this.state = state; if (disableOnStateChange) { Disable(); } if (state == ParameterState.Complete) { AwardCompletion(); } else if (state == ParameterState.Failed) { PenalizeFailure(); } OnStateChange.Fire(this, state); ContractConfigurator.OnParameterChange.Fire(Root, this); Parent.ParameterStateUpdate(this); }