protected override VisitResult Visit(ParameterChange parameterChange, ParameterChangeContext parameterChangeContext) { NextAction nextAction = Visit(_breakingChangeDefinitionsProvider.BreakingParameterChanges, parameterChange, parameterChange.ChangeType, parameterChangeContext); return(nextAction == NextAction.VisitChildTypes ? base.Visit(parameterChange, parameterChangeContext) : nextAction == NextAction.VisitNextSibling ? VisitResult.Continue : VisitResult.Stop); }
/// <summary> /// Attempts to set the value of the parameter to the new given value /// </summary> /// <param name="newValue">The value to change the parameter to</param> /// <param name="error">If the value is invalid this will contain a message as to why.</param> /// <returns>True if the parameter was set to the new value, false otherwise with an error message in error.</returns> public bool SetValue(string newValue, ref string error) { ParameterChange change = new ParameterChange(); return(Session.RunCommand(XTMFCommand.CreateCommand( // do ((ref string e) => { // Check to see if we are in a linked parameter change.ContainedIn = Session.ModelSystemModel.LinkedParameters.GetContained(this); if (change.ContainedIn == null) { change.NewValue = newValue; change.OldValue = _Value; if (!ArbitraryParameterParser.Check(RealParameter.Type, change.NewValue, ref e)) { return false; } Value = change.NewValue; } else { change.NewValue = newValue; change.OldValue = change.ContainedIn.GetValue(); return change.ContainedIn.SetWithoutCommand(change.NewValue, ref e); } return true; }), // undo (ref string e) => { if (change.ContainedIn == null) { Value = change.OldValue; } else { return change.ContainedIn.SetWithoutCommand(change.OldValue, ref e); } return true; }, // redo (ref string e) => { if (change.ContainedIn == null) { Value = change.NewValue; } else { return change.ContainedIn.SetWithoutCommand(change.NewValue, ref e); } return true; } ), ref error)); }
/// <summary> /// Attempts to set the value of the parameter to the new given value /// </summary> /// <param name="newValue">The value to change the parameter to</param> /// <param name="error">If the value is invalid this will contain a message as to why.</param> /// <returns>True if the parameter was set to the new value, false otherwise with an error message in error.</returns> public bool SetValue(string newValue, ref string error) { ParameterChange change = new ParameterChange(); return Session.RunCommand(XTMFCommand.CreateCommand( // do ((ref string e) => { // Check to see if we are in a linked parameter change.ContainedIn = Session.ModelSystemModel.LinkedParameters.GetContained(this); if(change.ContainedIn == null) { change.NewValue = newValue; change.OldValue = _Value; if(!ArbitraryParameterParser.Check(RealParameter.Type, change.NewValue, ref e)) { return false; } Value = change.NewValue; } else { change.NewValue = newValue; change.OldValue = change.ContainedIn.GetValue(); return change.ContainedIn.SetWithoutCommand(change.NewValue, ref e); } return true; }), // undo (ref string e) => { if(change.ContainedIn == null) { Value = change.OldValue; } else { return change.ContainedIn.SetWithoutCommand(change.OldValue, ref e); } return true; }, // redo (ref string e) => { if(change.ContainedIn == null) { Value = change.NewValue; } else { return change.ContainedIn.SetWithoutCommand(change.NewValue, ref e); } return true; } ), ref error); }
private void UpdateWaveFormat() { _waveFormat = NAudio.Wave.WaveFormat.CreateIeeeFloatWaveFormat(_reader.SampleRate, _reader.Channels); ParameterChange?.Invoke(this, EventArgs.Empty); }
public ParameterChange(ParameterChange <T> other) : base(other) { this.delegateSetter = other.delegateSetter; this.paramNewValue = other.paramNewValue; }
protected virtual VisitResult Visit(ParameterChange parameterChange, ParameterChangeContext parameterChangeContext) { return(VisitResult.Continue); }