void AddLeft() { var snsr = new ScriptElement(this) { ScriptHost = new SensorScriptObject(SensorFunctions) }; var func = new ScriptElement(this) { ScriptHost = new FunctionScriptObject(NumericFunctions) }; var plot = new ScriptElement(this) { ScriptHost = new PlotScriptObject(PlotFunctions) }; var oprt = new ScriptElement(this) { ScriptHost = new OperatorScriptObject() }; var list = new[] { snsr, func, plot, oprt }; var pos = ElementOffset; foreach (var el in list) { Add(LeftContainer, 5, pos, el); pos += ElementHeight + ElementOffset; } }
public void Shift(ScriptElement scriptElement, Double dx, Double dy) { var left = dx / _scale + Canvas.GetLeft(scriptElement); var top = dy / _scale + Canvas.GetTop(scriptElement); Canvas.SetLeft(scriptElement, left); Canvas.SetTop(scriptElement, top); }
public override void OnDropCompleted(IDataObject obj, Point dropPoint) { var canvas = TargetUI as Canvas; var elt = ExtractElement(obj) as ScriptElement; var copy = new ScriptElement(elt); canvas.Children.Add(copy); Canvas.SetLeft(copy, dropPoint.X); Canvas.SetTop(copy, dropPoint.Y); }
void AddRight() { var stmt = new ScriptElement(this) { ScriptHost = new StatementScriptObject() }; var cnds = new ScriptElement(this) { ScriptHost = new ConditionScriptObject() }; var list = new[] { stmt, cnds }; var pos = ElementOffset; foreach (var el in list) { Add(RightContainer, 5, pos, el); pos += ElementHeight + ElementOffset; } }
public ScriptElement(ScriptElement copy) : this(copy._owner) { ScriptHost = copy.ScriptHost.Copy(); }
void Add(Canvas container, Int32 left, Int32 top, ScriptElement element) { container.Children.Add(element); Canvas.SetLeft(element, left); Canvas.SetTop(element, top); }
public void RemoveChild(ScriptElement element) { element.ScriptHost.Dispose(); CenterContainer.Children.Remove(element); }