Example #1
0
        protected override Completion ExecuteImpl(ExecutionEnvironment enviroment)
        {
            if (X == null || Y == null)
            {
                return(Completion.Exception(Properties.Language.NullException, this));
            }
            var c = X.Execute(enviroment);

            if (!c.IsValue)
            {
                return(c);
            }
            if (!TypeConverters.IsNumber(c.ReturnValue))
            {
                return(Completion.Exception(Properties.Language.ValueNotNumberException, X));
            }
            double x = TypeConverters.GetValue <double>(c.ReturnValue);
            var    d = Y.Execute(enviroment);

            if (!d.IsValue)
            {
                return(d);
            }
            if (!TypeConverters.IsNumber(d.ReturnValue))
            {
                return(Completion.Exception(Properties.Language.ValueNotNumberException, Y));
            }
            double     y   = TypeConverters.GetValue <double>(d.ReturnValue);
            DrawWindow wnd = CanvasEnvironment.GetCanvas(enviroment);

            wnd.Goto(x, y);
            return(Completion.Void);
        }
Example #2
0
        public Completion Assign(ExecutionEnvironment environment, object value)
        {
            if (!TypeConverters.IsNumber(value))
            {
                return(Completion.Exception(Properties.Language.ValueNotNumberException, this));
            }
            DrawWindow wnd = CanvasEnvironment.GetCanvas(environment);

            wnd.Y = TypeConverters.GetValue <double>(value);
            wnd.Goto(wnd.X, wnd.Y);
            return(new Completion(value));
        }