Example #1
0
        public ScriptParameter ParameterCreateRegister(int id, string name, double value, double start, double stop, double step)
        {
            this.checkThrowParameterAlreadyRegistered(id, name);
            ScriptParameter strategyParameter = new ScriptParameter(id, name, value, start, stop, step);

            this.Parameters.Add(id, strategyParameter);
            return(strategyParameter);
        }
Example #2
0
        public void DropChangedValueToScriptAndCurrentContextAndSerialize(ScriptParameter scriptParameter)
        {
            int    paramId  = scriptParameter.Id;
            double valueNew = scriptParameter.ValueCurrent;

            // merge them to ONE !! I hate proxies and facades...
            this.Script.Parameters[paramId].ValueCurrent = valueNew;
            //double valueOld = this.ScriptContextCurrent.ParameterValuesById[paramId];
            this.ScriptContextCurrent.ParameterValuesById[paramId] = valueNew;
            Assembler.InstanceInitialized.RepositoryDllJsonStrategy.StrategySave(this);
        }
Example #3
0
        protected void checkThrowParameterAlreadyRegistered(int id, string name)
        {
            if (this.Parameters.ContainsKey(id) == false)
            {
                return;
            }
            ScriptParameter param = this.Parameters[id];
            string          msg   = "Script[" + this.StrategyName + "] already had parameter {id[" + param.Id + "] name[" + param.Name + "]}"
                                    + " while adding {id[" + id + "] name[" + name + "]}; edit source code and make IDs unique for every parameter";

            throw new Exception(msg);
        }
		private SliderComboControl SliderComboFactory(ScriptParameter parameter) {
			//v1 WOULD_BE_TOO_EASY ret = this.templateSliderControl.Clone();
			//BEGIN merged with SlidersAutoGrow.Designer.cs:InitializeComponent()
			SliderComboControl ret = new SliderComboControl();
			//SCHEMA1
			//ret.ColorBgMouseOver = System.Drawing.Color.Gold;
			//ret.ColorBgValueCurrent = System.Drawing.SystemColors.ActiveCaption;
			//ret.ColorFgParameterLabel = System.Drawing.Color.RoyalBlue;
			//ret.ColorFgValues = System.Drawing.Color.Lime;
			//SCHEMA2
			//ret.ColorBgMouseOver = System.Drawing.Color.Gold;
			//ret.ColorBgValueCurrent = System.Drawing.Color.LightSteelBlue;
			//ret.ColorFgParameterLabel = System.Drawing.Color.AliceBlue;
			//ret.ColorFgValues = System.Drawing.Color.Magenta;
			//SCHEMA3
			//ret.ColorBgMouseOver = System.Drawing.Color.Thistle;
			//ret.ColorBgValueCurrent = System.Drawing.Color.LightSteelBlue;
			//ret.ColorFgParameterLabel = System.Drawing.Color.White;
			//ret.ColorFgValues = System.Drawing.Color.DeepPink;
			//Designer!
			ret.ColorBgMouseOverEnabled = this.templateSliderControl.ColorBgMouseOverEnabled;
//			ret.ColorBgMouseOverDisabled = this.templateSliderControl.ColorBgMouseOverDisabled;
			ret.ColorBgValueCurrent = this.templateSliderControl.ColorBgValueCurrent;
			ret.ColorFgParameterLabel = this.templateSliderControl.ColorFgParameterLabel;
			ret.ColorFgValues = this.templateSliderControl.ColorFgValues;

			//ret.Anchor = (System.Windows.Forms.AnchorStyles)(System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right);
			//ret.Padding = new System.Windows.Forms.Padding(4, 0, 4, 0);
			ret.Anchor = this.templateSliderControl.Anchor;
			ret.Padding = this.templateSliderControl.Padding;
			ret.PaddingPanelSlider = this.templateSliderControl.PaddingPanelSlider;
			//END merged

			ret.LabelText = parameter.Name;
			ret.Name = "parameter_" + parameter.Name;
			ret.ValueCurrent = new decimal(parameter.ValueCurrent);
			ret.ValueMax = new decimal(parameter.ValueMax);
			ret.ValueMin = new decimal(parameter.ValueMin);
			ret.ValueStep = new decimal(parameter.ValueIncrement);
			ret.EnableBorder = this.AllSlidersHaveBorder;
			ret.EnableNumeric = this.AllSlidersHaveNumeric;
			//DOESNT_WORK?... ret.PanelFillSlider.Padding = new System.Windows.Forms.Padding(0, 1, 0, 0);
			//ret.PaddingPanelSlider = new System.Windows.Forms.Padding(0, 1, 0, 0);
			ret.Location = new System.Drawing.Point(0, this.PreferredHeight + this.VerticalSpaceBetweenSliders);
			ret.Size = new System.Drawing.Size(this.Width, ret.Size.Height);
			ret.Tag = parameter;
			ret.ValueCurrentChanged += slider_ValueCurrentChanged;
			// WILL_ADD_PARENT_MENU_ITEMS_IN_Opening
			return ret;
		}
		public ScriptParameterEventArgs(ScriptParameter scriptParameter) {
			this.ScriptParameter = scriptParameter;
		}
		public ScriptParameter ParameterCreateRegister(int id, string name, double value, double start, double stop, double step) {
			this.checkThrowParameterAlreadyRegistered(id, name);
			ScriptParameter strategyParameter = new ScriptParameter(id, name, value, start, stop, step);
			this.Parameters.Add(id, strategyParameter);
			return strategyParameter;
		}
		void RaiseOnSliderValueChanged(ScriptParameter parameter) {
			if (this.SliderValueChanged == null) return;
			this.SliderValueChanged(this, new ScriptParameterEventArgs(parameter));
		}
		public void DropChangedValueToScriptAndCurrentContextAndSerialize(ScriptParameter scriptParameter) {
			int paramId = scriptParameter.Id;
			double valueNew = scriptParameter.ValueCurrent;
			// merge them to ONE !! I hate proxies and facades...
			this.Script.Parameters[paramId].ValueCurrent = valueNew;
			//double valueOld = this.ScriptContextCurrent.ParameterValuesById[paramId];
			this.ScriptContextCurrent.ParameterValuesById[paramId] = valueNew;
			Assembler.InstanceInitialized.RepositoryDllJsonStrategy.StrategySave(this);
		}
Example #9
0
 public ScriptParameterEventArgs(ScriptParameter scriptParameter)
 {
     this.ScriptParameter = scriptParameter;
 }