protected override void DefineBindings(IObjectBinder objBinder) { base.DefineBindings(objBinder); var binder = (ObjectBinder <SimulationContext>)objBinder; binder.AddOption(sc => sc.Years, "-y") .Description("years to simulate") .DefaultValue(10) .Validator(OptionInRange <int> .GreaterThanEqual(1)); binder.AddOption(sc => sc.Investments, "-i") .Description("investments to simulate") .DefaultValue(5) .Validator(OptionInRange <int> .GreaterThanEqual(1)); binder.AddOption(sc => sc.Simulations, "-s") .Description("simulations to run") .DefaultValue(10) .Validator(OptionInRange <int> .GreaterThanEqual(1)); binder.AddOption(sc => sc.MeanMarketReturn, "-r") .Description("mean annual rate of return for the total market") .DefaultValue(0.1) .Validator(OptionInRange <double> .GreaterThan(0.0)); binder.AddOption(sc => sc.StdDevMarketReturn, "-d") .Description("standard deviation of total market annual rate of return") .DefaultValue(0.2) .Validator(OptionInRange <double> .GreaterThan(0.0)); }
private InvWorkPoint(Point point, IObjectBinder binder) { this.point = point; this.binder = binder; if (binder.DocumentManager.ActiveAssemblyDoc != null) { this.binder.ContextManager.BindingContextManager = binder.DocumentManager.ActiveAssemblyDoc.ReferenceKeyManager; } else if (binder.DocumentManager.ActivePartDoc != null) { this.binder.ContextManager.BindingContextManager = binder.DocumentManager.ActivePartDoc.ReferenceKeyManager; } this.binder.ContextManager.BindingContextManager = binder.DocumentManager.ActiveAssemblyDoc.ReferenceKeyManager; Inventor.WorkPoint wp; if (this.binder.GetObjectFromTrace<Inventor.WorkPoint>(out wp)) { InternalWorkPoint = wp; AssemblyWorkPointDef wpDef = (AssemblyWorkPointDef)wp.Definition; wpDef.Point = point.ToPoint(); } else { wp = binder.DocumentManager.ActiveAssemblyDoc.ComponentDefinition.WorkPoints.AddFixed(point.ToPoint(), false); InternalWorkPoint = wp; this.binder.SetObjectForTrace<InvWorkPoint>(this.InternalWorkPoint); } }
private InvWorkPoint(Point point, IObjectBinder binder) { this.point = point; this.binder = binder; if (binder.DocumentManager.ActiveAssemblyDoc != null) { this.binder.ContextManager.BindingContextManager = binder.DocumentManager.ActiveAssemblyDoc.ReferenceKeyManager; } else if (binder.DocumentManager.ActivePartDoc != null) { this.binder.ContextManager.BindingContextManager = binder.DocumentManager.ActivePartDoc.ReferenceKeyManager; } this.binder.ContextManager.BindingContextManager = binder.DocumentManager.ActiveAssemblyDoc.ReferenceKeyManager; Inventor.WorkPoint wp; if (this.binder.GetObjectFromTrace <Inventor.WorkPoint>(out wp)) { InternalWorkPoint = wp; AssemblyWorkPointDef wpDef = (AssemblyWorkPointDef)wp.Definition; wpDef.Point = point.ToPoint(); } else { wp = binder.DocumentManager.ActiveAssemblyDoc.ComponentDefinition.WorkPoints.AddFixed(point.ToPoint(), false); InternalWorkPoint = wp; this.binder.SetObjectForTrace <InvWorkPoint>(this.InternalWorkPoint); } }
protected override void DefineBindings(IObjectBinder objBinder) { var binder = (ObjectBinder <MainClass>)objBinder; binder.AddOption(mc => mc.Sub.IntProperty, "-i") .DefaultValue(-5); binder.AddOption(mc => mc.TextProperty, "-t") .DefaultValue("ralph"); }
public static bool TryAssignKeyValues(this ICodec codec, IHttpEntity entity, IObjectBinder binder, Action<KeyedValues> assigned, Action<KeyedValues> failed) { return codec.ReadKeyValues(entity) .AsObservable(x => from kv in x where kv.SetProperty(binder) select kv, assigned, failed) .Count() > 0; }
public static bool TryAssignKeyValues(this ICodec codec, IHttpEntity entity, IObjectBinder binder, Action <KeyedValues> assigned, Action <KeyedValues> failed) { return(codec.ReadKeyValues(entity) .AsObservable(x => from kv in x where kv.SetProperty(binder) select kv, assigned, failed) .Count() > 0); }
private InvWorkPoint(Point point, IObjectBinder binder) { _binder = binder; Inventor.WorkPoint wp; if (_binder.GetObjectFromTrace <Inventor.WorkPoint>(out wp)) { InternalWorkPoint = wp; AssemblyWorkPointDef wpDef = (AssemblyWorkPointDef)wp.Definition; wpDef.Point = point.ToPoint(); } else { wp = PersistenceManager.ActiveAssemblyDoc.ComponentDefinition.WorkPoints.AddFixed(point.ToPoint(), false); InternalWorkPoint = wp; _binder.SetObjectForTrace <WorkPoint>(this.InternalWorkPoint); } }
protected override void DefineBindings(IObjectBinder objBinder) { base.DefineBindings(objBinder); var binder = (ObjectBinder <BetaDistribution>)objBinder; binder.AddOption(b => b.Alpha, "-a") .Description("alpha parameter for beta distribution of investment betas") .DefaultValue(1.0) .Validator(OptionInRange <double> .GreaterThan(0.0)); binder.AddOption(b => b.Beta, "-b") .Description("beta parameter for beta distribution of investment betas") .DefaultValue(2.0) .Validator(OptionInRange <double> .GreaterThan(0.0)); binder.AddOption(b => b.Maximum, "-x") .Description("maximum investment beta") .DefaultValue(2.0); binder.AddOption(b => b.Minimum, "-m") .Description("minimum investment beta") .DefaultValue(-2.0); }
public static void RegisterCustomObjectCreator(IObjectBinder objectBinder) { _objectBinder.Register(objectBinder); }
public void Register(IObjectBinder objectBinder) { _customObjectBinders.Add(objectBinder); }
public PropertyHandler(IObjectBinder parent) : base(parent) { }
public EventHandler(IObjectBinder parent) : base(parent) { }
public NestedTypeGetter(IObjectBinder parent) : base(parent) { }
public static void RegisterCustomObjectCreator(IObjectBinder objectBinder) { _customObjectBinders.Add(objectBinder); }
public static bool TryAssignKeyValues(this ICodec codec, IHttpEntity entity, IObjectBinder binder) { return(TryAssignKeyValues(codec, entity, binder, null, null)); }
public InputMember(IMember member, IObjectBinder binder, bool isOptional) { this.Member = member; this.Binder = binder; this.IsOptional = isOptional; }
public static bool TryAssignKeyValues(this ICodec codec, IHttpEntity entity, IObjectBinder binder) { return TryAssignKeyValues(codec, entity, binder, null, null); }
public FieldHandler(IObjectBinder parent) : base(parent) { }
public MethodGetter(IObjectBinder parent) : base(parent) { }
public override bool SetProperty(IObjectBinder binder) { return(WasUsed = binder.SetProperty(Key, Values, Converter)); }
public BaseHandler(IObjectBinder parent) { binder = parent; }
/// <summary> /// Tries to set the value on the provided object binder. /// </summary> /// <param name="binder">The <see cref="IObjectBinder"/> to use when applying the value.</param> /// <returns><c>true</c> if the assignment was successful, otherwise <c>false</c>.</returns> public abstract bool SetProperty(IObjectBinder binder);
public static CommandLineBuilder UseObjectBinder(this CommandLineBuilder builder, IObjectBinder objBinder) { builder.UseMiddleware(async(context, next) => { var resultCode = await objBinder.Bind(context); await next(context); }); return(builder); }
public ScriptableHandler(IObjectBinder parent) : base(parent) { }
public OperationMember(IMember member, IObjectBinder binder, bool isOptional) { Member = member; Binder = binder; IsOptional = isOptional; }
public OperationMember(IMember member, IObjectBinder binder, bool optional) { this.Member = member; this.Binder = binder; this.IsOptional = optional; }
private InvWorkPoint(Point point, IObjectBinder binder) { _binder = binder; Inventor.WorkPoint wp; if (_binder.GetObjectFromTrace<Inventor.WorkPoint>(out wp)) { InternalWorkPoint = wp; AssemblyWorkPointDef wpDef = (AssemblyWorkPointDef)wp.Definition; wpDef.Point = point.ToPoint(); } else { wp = PersistenceManager.ActiveAssemblyDoc.ComponentDefinition.WorkPoints.AddFixed(point.ToPoint(), false); InternalWorkPoint = wp; _binder.SetObjectForTrace<WorkPoint>(this.InternalWorkPoint); } }
public SandboxBinder(IObjectBinder orig) { _orig = orig; }
public InputMember(IMember member, IObjectBinder binder, bool isOptional) { Member = member; Binder = binder; IsOptional = isOptional; }
protected virtual void DefineBindings(IObjectBinder objBinder) { }