コード例 #1
0
        public HomeViewModel()
        {
            _context.Database.EnsureCreated();
            _context.Plants.Load();
            _context.Locations.Load();
            _context.Areas.Load();

            IList <Location> locations = _context.Locations.Local.ToObservableCollection();
            IList <Area>     areas     = _context.Areas.Local.ToObservableCollection();
            IList <Plant>    plants    = _context.Plants.Local.ToObservableCollection();
            List <Object>    allS      = (from x in plants select(Object) x).ToList();

            allS.AddRange((from x in locations select(Object) x).ToList());
            allS.AddRange((from x in areas select(Object) x).ToList());

            HomeView = CollectionViewSource.GetDefaultView(allS);

            groupByLocationCommand = new GroupByLocationCommand(this); //OrderGroupCommand.cs
            groupByAreaCommand     = new GroupByAreaCommand(this);
            removeGroupCommand     = new RemoveGroupCommand(this);
            saveButtonCommand      = new SaveButtonCommand(this);
            deleteButtonCommand    = new DeleteButtonCommand(this);

            HomeView.GroupDescriptions.Add(new PropertyGroupDescription("AreaName"));
            HomeView.GroupDescriptions.Add(new PropertyGroupDescription("LocationName"));
        }
コード例 #2
0
        public void InkCanvas_Gesture(object sender, InkCanvasGestureEventArgs e)
        {
            ReadOnlyCollection<GestureRecognitionResult> gestureResults =
            e.GetGestureRecognitionResults();
            Rect bound = e.Strokes.GetBounds();
            System.Drawing.Rectangle rectangleBound = ConvertClass.getInstance().RectToRectangle(bound);
            if (gestureResults[0].RecognitionConfidence == RecognitionConfidence.Strong)
            {
                switch (gestureResults[0].ApplicationGesture)
                {
                    case ApplicationGesture.ScratchOut:
                        
                        foreach (MyButton myButton in _inkFrame.InkCollector.Sketch.MyButtons)
                        {
                            Rect rectMyButton=new Rect(new Point(myButton.Left,myButton.Top),new Point(myButton.Left+myButton.Width,myButton.Top+myButton.Height));
                            if (MathTool.getInstance().isHitRects(e.Strokes.GetBounds(), rectMyButton) == true)
                            {
                                DeleteButtonCommand dbc = new DeleteButtonCommand(_inkFrame.InkCollector, myButton,_videoList);
                                dbc.execute();
                                InkCollector.CommandStack.Push(dbc);
                            }
                        }
                        foreach (MyArrow myArrow in _inkFrame.InkCollector.Sketch.MyArrows)
                        {
                            Rect rectMyButton = new Rect(myArrow.StartPoint,myArrow.EndPoint);
                            if (MathTool.getInstance().isHitRects(e.Strokes.GetBounds(), rectMyButton) == true)
                            {
                                Command dac = new DeleteArrowCommand(_inkFrame.InkCollector, myArrow);
                                dac.execute();
                                InkCollector.CommandStack.Push(dac);
                            }
                        }
                        break;
                    case ApplicationGesture.Down:
                        if (downcount == 1)
                        {
                            getKeyFramesInGivenVideoClip(_inkFrame.InkCollector.Sketch.MyButtons[0].VideoPath.Substring(8),
                                (int)_inkFrame.InkCollector.Sketch.MyButtons[0].TimeEnd,
                               (int)_inkFrame.InkCollector.Sketch.MyButtons[1].TimeStart);
                        }
                        else if (downcount == 0)
                        {
                            getKeyFramesInGivenVideoClip(_inkFrame.InkCollector.Sketch.MyButtons[0].VideoPath.Substring(8),
                                (int)_inkFrame.InkCollector.Sketch.MyButtons[5].TimeEnd,
                               (int)_inkFrame.InkCollector.Sketch.MyButtons[6].TimeStart);
                        }
                        else if (downcount == 2)
                        {
                            getKeyFramesInGivenVideoClip(_inkFrame.InkCollector.Sketch.MyButtons[0].VideoPath.Substring(8),
                                (int)_inkFrame.InkCollector.Sketch.MyButtons[6].TimeEnd,
                               (int)_inkFrame.InkCollector.Sketch.MyButtons[7].TimeStart);
                            InkCollector.Mode = InkMode.VideoPlay;
                        }
                        //else if (downcount == 3)
                        //{
                        //    getKeyFramesInGivenVideoClip(_inkFrame.InkCollector.Sketch.MyButtons[0].VideoPath.Substring(8),
                        //        (int)_inkFrame.InkCollector.Sketch.MyButtons[8].TimeEnd,
                        //       (int)_inkFrame.InkCollector.Sketch.MyButtons[9].TimeStart);
                        //}
                        downcount++;
                        //getKeyFramesInGivenVideoClip(GlobalValues.FilesPath + "/麋鹿王.avi", 0,
                        //       1069000);
                        break;
                }

            }
        }