public override bool FromScriptVariable(MotionProcEnv environment, ScriptVariable variable, ref string errorMessage) { Sequence.SequenceData parent = this.Parent.Value; switch (variable.Type) { case ScriptVariableType.Number: int index = variable.ToInteger(); if (index < 0 || index >= parent.Values.ColumnCount) { errorMessage = MotionDataHandler.Properties.Settings.Default.Msg_IndexOutOfRange + ": " + index.ToString(); return(false); } this.Value = index; return(true); case ScriptVariableType.String: string name = variable.ToString(); int index2 = Array.IndexOf(parent.Values.ColumnNames, name); if (index2 == -1) { errorMessage = MotionDataHandler.Properties.Settings.Default.Msg_ColumnNameNotFound; return(false); } this.Value = index2; return(true); default: errorMessage = MotionDataHandler.Properties.Settings.Default.Msg_SpecifyIndexOfColumnOrColumnName; return(false); } }
public override Panel CreatePanel(MotionProcEnv environment) { Panel ret = new Panel(); ret.Height = 160; GroupBox group = new GroupBox(); group.Text = ParamName; group.Dock = DockStyle.Fill; Sequence.SequenceSelectionControl list = new MotionDataHandler.Sequence.SequenceSelectionControl(); list.AttachController(environment.SequenceController, _conditionToShowOnList); list.SelectionMode = SelectionMode.One; list.SelectedIndexChanged += new EventHandler((s, e) => { IList <Sequence.SequenceData> items = list.SelectedItems; if (items.Count == 1) { this.Value = items[0]; } else { this.Value = null; } this.DoValueChanged(); }); int index = 0; list.SelectedIndices.Clear(); foreach (var viewer in environment.SequenceController.GetViewList()) { if (Value == viewer.Sequence) { list.SelectedIndices.Add(index); } if (_conditionToShowOnList(viewer)) { index++; } } list.Dock = DockStyle.Fill; group.Controls.Add(list); ret.Controls.Add(group); return(ret); }
public override bool FromScriptVariable(MotionProcEnv environment, ScriptVariable variable, ref string errorMessage) { IList <ScriptVariable> list = variable.ToList(); if (list.Count != 1) { errorMessage = MotionDataHandler.Properties.Settings.Default.Msg_SpecifyOneSequenceName; return(false); } var str = list[0]; string name = str.ToString(); Sequence.SequenceData sequence = environment.SequenceController.GetSequenceByTitle(name); if (sequence == null) { errorMessage = MotionDataHandler.Properties.Settings.Default.Msg_SequenceNotFound + ": " + name; return(false); } this.Value = sequence; return(true); }
public SequenceSingleSelectParameter(string paramName, Func <Sequence.SequenceView, bool> conditionToShowOnList) : base(paramName) { this.Value = null; _conditionToShowOnList = conditionToShowOnList; }