예제 #1
0
        //--------------------------------------------------------------------
        void OnMouseHover(UITimerTask timerTask)
        {
            return;
            //HitTestCoreWithPrevChainHint(hitPointChain.LastestRootX, hitPointChain.LastestRootY);
            //RenderElement hitElement = this.hitPointChain.CurrentHitElement as RenderElement;
            //if (hitElement != null && hitElement.IsTestable)
            //{
            //    DisableGraphicOutputFlush = true;
            //    Point hitElementGlobalLocation = hitElement.GetGlobalLocation();

            //    UIMouseEventArgs e2 = new UIMouseEventArgs();
            //    e2.WinTop = this.topwin;
            //    e2.Location = hitPointChain.CurrentHitPoint;
            //    e2.SourceHitElement = hitElement;
            //    IEventListener ui = hitElement.GetController() as IEventListener;
            //    if (ui != null)
            //    {
            //        ui.ListenMouseEvent(UIMouseEventName.MouseHover, e2);
            //    }

            //    DisableGraphicOutputFlush = false;
            //    FlushAccumGraphicUpdate();
            //}
            //hitPointChain.SwapHitChain();
            //hoverMonitoringTask.SetEnable(false, this.topwin);
        }
예제 #2
0
        public ActionResult New(string id)
        {
            if (engine == null)
            {
                return(View("Error", ERROR_MESSAGE));
            }

            UiTimerNode node = engine.GetNode(id) as UiTimerNode;

            if (node == null)
            {
                return(NotFound());
            }

            ViewBag.NodeId = node.Id;
            ViewBag.Name   = node.Settings["Name"].Value;

            UITimerTask task = new UITimerTask
            {
                NodeId            = id,
                ExecutionDate     = DateTime.Now,
                RepeatingInterval = 1000,
                Enabled           = true
            };

            return(View(task));
        }
예제 #3
0
        public ActionResult Disable(string id, int id2)
        {
            if (engine == null)
            {
                return(View("Error", ERROR_MESSAGE));
            }

            UiTimerNode node = engine.GetNode(id) as UiTimerNode;

            if (node == null)
            {
                return(NotFound());
            }

            UITimerTask task = node.GetTask(id2);

            if (task == null)
            {
                return(NotFound());
            }

            task.Enabled = false;

            node.UpdateTask(task);

            if (Request.Headers["Referer"].Any())
            {
                return(Redirect(Request.Headers["Referer"].ToString()));
            }
            else
            {
                return(RedirectToAction("Tasks"));
            }
        }
예제 #4
0
        public ActionResult Edit(string id, int id2)
        {
            if (engine == null)
            {
                return(View("Error", ERROR_MESSAGE));
            }

            UiTimerNode node = engine.GetNode(id) as UiTimerNode;

            if (node == null)
            {
                return(NotFound());
            }

            UITimerTask task = node.GetTask(id2);

            if (task == null)
            {
                return(NotFound());
            }

            ViewBag.Name = node.Settings["Name"].Value;

            return(View(task));
        }
예제 #5
0
        public static void RegisterTimerTask(int intervalMillisec, UITimerTask.TimerTick timerTick)
        {
            UITimerTask timerTask = new UITimerTask(timerTick);

            timerTask.IntervalInMillisec = intervalMillisec;
            UIMsgQueueSystem.InternalMsgPumpRegister(timerTask);
            timerTask.Enabled = true;
        }
예제 #6
0
        public ActionResult New(UITimerTask task)
        {
            if (engine == null)
            {
                return(View("Error", ERROR_MESSAGE));
            }

            UiTimerNode node = engine.GetNode(task.NodeId) as UiTimerNode;

            if (node == null)
            {
                return(NotFound());
            }

            node.AddTask(task);

            return(RedirectToAction("Tasks", new { id = task.NodeId }));
        }
예제 #7
0
        public ActionResult Edit(UITimerTask task, int TaskId)
        {
            if (engine == null)
            {
                return(View("Error", ERROR_MESSAGE));
            }

            task.Id = TaskId; //pasing id dont work!
            UiTimerNode node = engine.GetNode(task.NodeId) as UiTimerNode;

            if (node == null)
            {
                return(NotFound());
            }

            node.UpdateTask(task);

            return(RedirectToAction("Tasks", new { id = task.NodeId }));
        }
예제 #8
0
 public static void RegisterTimerTask(UITimerTask uiTimerTask)
 {
     UIMsgQueueSystem.InternalMsgPumpRegister(uiTimerTask);
 }
예제 #9
0
        void TimImageLoadMonitor_Tick(UITimerTask timer_task)
        {
            lock (inputListSync)
            {
                if (working)
                {
                    return;
                }
                if (!hasSomeInputHint)
                {
                    return;
                }
                working = true;
            }



            int j = inputList.Count;
            //load image in this list
            List <ImageBinder> tmploadingList = new List <ImageBinder>();

            //copy data out
            for (int i = 0; i < j; ++i)
            {
                var firstNode = inputList.First;
                inputList.RemoveFirst();
                ImageBinder binder = firstNode.Value;
                //wait until finish this  ....


                //1. check from cache if not found
                //then send request to external ...

                Image foundImage;
                if (!this.imageCacheLevel0.TryGetCacheImage(
                        binder.ImageSource,
                        out foundImage))
                {
                    this.ImageLoadingRequest(
                        this,
                        new ContentManagers.ImageRequestEventArgs(
                            binder));
                    //....
                    //process image infomation
                    //....
                    if (binder.State == ImageBinderState.Loaded)
                    {
                        //store to cache
                        //TODO: implement caching policy
                        imageCacheLevel0.AddCacheImage(binder.ImageSource, binder.Image);
                    }
                }
                else
                {
                    //process image infomation
                    //....
                    binder.SetImage(foundImage);
                }

                //next image
            }
            if (j == 0)
            {
                hasSomeInputHint = false;
            }


            //if (hasSomeOutputHint)
            //{
            //    lock (outputListSync)
            //    {
            //        if (outputList.Count > 0)
            //        {
            //        }
            //    }
            //}
            working = false;
        }
예제 #10
0
        static void SetupActiveBoxProperties(LayoutFarm.CustomWidgets.EaseBox box)
        {
            //1. mouse down

            bool mouseUpFromDragging = false;

            System.DateTime mouseDownTime = System.DateTime.MinValue;
            System.DateTime mouseUpTime = System.DateTime.MinValue;
            int             mdown_x = 0, mdown_y = 0;
            double          velo_x = 0;
            double          velo_y = 0;
            int             x_dir  = 0;
            int             y_dir  = 0;

            UI.UITimerTask animateTimer = new UITimerTask(tim =>
            {
                box.SetLocation(box.Left + (int)(velo_x * 10 * x_dir),
                                box.Top + (int)(velo_y * 10 * y_dir));

                velo_x -= 0.1;
                velo_y -= 0.1;

                if (velo_x <= 0)
                {
                    velo_x = 0;
                }
                if (velo_y <= 0)
                {
                    velo_y = 0;
                }
                if (velo_x == 0 && velo_y == 0)
                {
                    tim.Enabled = false;
                }
            });
            animateTimer.IntervalInMillisec = 10;
            UIPlatform.RegisterTimerTask(animateTimer);


            box.MouseDown += (s, e) =>
            {
                mdown_x = box.Left;
                mdown_y = box.Top;
                animateTimer.Enabled = false;

                mouseDownTime       = System.DateTime.Now;
                mouseUpFromDragging = false;
                //
                box.BackColor      = KnownColors.FromKnownColor(KnownColor.DeepSkyBlue);
                e.MouseCursorStyle = MouseCursorStyle.Pointer;
            };
            //2. mouse up
            box.MouseUp += (s, e) =>
            {
                mouseUpTime        = System.DateTime.Now;
                e.MouseCursorStyle = MouseCursorStyle.Default;
                box.BackColor      = Color.LightGray;

                if (mouseUpFromDragging)
                {
                    int mup_x = box.Left;
                    int mup_y = box.Top;

                    System.TimeSpan drag_timespan = mouseUpTime - mouseDownTime;
                    double          ms            = drag_timespan.Milliseconds;

                    double displacement_x = mup_x - mdown_x;
                    double displacement_y = mup_y - mdown_y;
                    velo_x = System.Math.Abs(displacement_x / ms);
                    velo_y = System.Math.Abs(displacement_y / ms);

                    x_dir = (mup_x >= mdown_x) ? 1 : -1;
                    y_dir = (mup_y >= mdown_y) ? 1 : -1;
                    animateTimer.Enabled = true;
                }
            };
            box.MouseDrag += (s, e) =>
            {
                mouseUpFromDragging = true;
                box.BackColor       = KnownColors.FromKnownColor(KnownColor.GreenYellow);
                Point pos = box.Position;
                box.SetLocation(pos.X + e.XDiff, pos.Y + e.YDiff);
                e.MouseCursorStyle = MouseCursorStyle.Pointer;
                e.CancelBubbling   = true;
            };
        }