示例#1
0
        private void ExcuteAreaCanvasLeftButtonUpCommandDo(Models.ExParameters p)
        {
            if (!CanGridMapSelect)
            {
                return;
            }
            Canvas canvas          = p.Parameter as Canvas;
            MouseButtonEventArgs e = p.EventArgs as MouseButtonEventArgs;
            Point point            = e.GetPosition(canvas);

            if (!(DownPoint.X == 0 && DownPoint.Y == 0) &&
                Math.Abs(DownPoint.X - point.X) > AreaThreshold && Math.Abs(DownPoint.Y - point.Y) > AreaThreshold)
            {
                //To set Selected ListBox Item
                for (int i = 0; i < gridMapItems.Count; i++)
                {
                    if ((gridMapItems[i].TopPad + gridMapItems[i].Height > AreaRectTopPad && gridMapItems[i].TopPad < AreaRectTopPad + AreaRectHeight) &&
                        (gridMapItems[i].LeftPad + gridMapItems[i].Width > AreaRectLeftPad && gridMapItems[i].LeftPad < AreaRectLeftPad + AreaRectWidth))
                    {
                        gridMapItems[i].IsSelected = true;
                    }
                    else
                    {
                        gridMapItems[i].IsSelected = false;
                    }
                }
            }
            ExecuteModifyCommand.RaiseCanExecuteChanged();
            AreaRectHeight  = 0;
            AreaRectLeftPad = 0;
            AreaRectWidth   = 0;
            AreaRectHeight  = 0;
            DownPoint       = new Point();
        }
示例#2
0
 private void ExecuteCancelSelectCommandDo()
 {
     CanGridMapSelect = false;
     for (int i = 0; i < gridMapItems.Count; i++)
     {
         gridMapItems[i].IsSelected = false;
     }
     ExecuteModifyCommand.RaiseCanExecuteChanged();
 }