Example #1
0
        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;
            }
        }
Example #2
0
        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);
        }
Example #3
0
        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);
        }
Example #4
0
        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;
            }
        }
Example #5
0
 public ScriptElement(ScriptElement copy) :
     this(copy._owner)
 {
     ScriptHost = copy.ScriptHost.Copy();
 }
Example #6
0
 void Add(Canvas container, Int32 left, Int32 top, ScriptElement element)
 {
     container.Children.Add(element);
     Canvas.SetLeft(element, left);
     Canvas.SetTop(element, top);
 }
Example #7
0
 public void RemoveChild(ScriptElement element)
 {
     element.ScriptHost.Dispose();
     CenterContainer.Children.Remove(element);
 }