Ejemplo n.º 1
0
        private void SetMouseDectectedRegion(Point basePt, List <ZoneModel> allzones)
        {
            var regions = new List <MouseDetectedRegion>();

            foreach (var zone in allzones)
            {
                Rect relative = zone.GetRect();
                Rect absolute = new Rect(
                    new Point(relative.Left + basePt.X, relative.Top + basePt.Y),
                    new Point(relative.Right + basePt.X, relative.Bottom + basePt.Y)
                    );

                MouseDetectedRegion r = new MouseDetectedRegion()
                {
                    RegionIndex   = -1,
                    DetectionRect = absolute,
                };

                r.Callback = zone.OnReceiveMouseEvent;
                regions.Add(r);
            }

            gMouseEventCtrl.DetectionRegions = regions.ToArray();
        }
Ejemplo n.º 2
0
        public void RefreshStage()
        {
            List <MouseDetectedRegion> regions = new List <MouseDetectedRegion>();

            SpaceCanvas.Children.Clear();
            SpaceCanvas.Children.Add(GridImage);
            SpaceCanvas.Children.Add(RestrictLineLeft);
            SpaceCanvas.Children.Add(RestrictLineRight);
            SpaceCanvas.Children.Add(RestrictLineTop);
            SpaceCanvas.Children.Add(RestrictLineBottom);
            SpaceCanvas.Children.Add(MouseRectangle);

            var onStageList = DeviceModelCollection.FindAll(d => d.Plugged == true && d.Sync == true);

            foreach (var dm in onStageList)
            {
                List <ZoneModel> allzones = dm.AllZones;
                SortByZIndex(allzones);

                foreach (var zone in allzones)
                {
                    Rect relative = zone.GetRect();
                    Rect absolute = new Rect(
                        new Point(relative.Left + dm.PixelLeft, relative.Top + dm.PixelTop),
                        new Point(relative.Right + dm.PixelLeft, relative.Bottom + dm.PixelTop)
                        );

                    MouseDetectedRegion r = new MouseDetectedRegion()
                    {
                        RegionIndex   = -1,
                        DetectionRect = absolute,
                        GroupIndex    = dm.Type
                    };

                    r.Callback = zone.OnReceiveMouseEvent;

                    regions.Add(r);
                }

                DeviceView view = new DeviceView();
                view.DataContext = dm;
                SpaceCanvas.Children.Add(view);
            }

            m_MouseEventCtrl.DetectionRegions = regions.ToArray();
            GoToBlankEditing();
            StopScrollTimer();


            if (DeviceModelCollection.FindAll(find => find.Plugged == true).Count == 0)
            {
                MaskManager.GetInstance().ShowMask(MaskType.NoSupportDevice);
            }
            else if (DeviceModelCollection.Find(find => find.Sync == true) == null)
            {
                MaskManager.GetInstance().ShowMask(MaskType.NoSyncDevice);
            }
            else
            {
                MaskManager.GetInstance().ShowMask(MaskType.None);
            }
        }