Exemplo n.º 1
0
 private static void OnCellMouseEnter(object sender, MouseEventArgs e)
 {
     if (Mouse.LeftButton == MouseButtonState.Pressed)
     {
         var cell = e.ExtractDataContext <MineCell>();
         if (cell != null)
         {
             if (Mouse.RightButton == MouseButtonState.Pressed)
             {
                 cell.PressState = PressState.DoublePressed;
                 var vm = e.ExtractDataContext <ClearMineViewModel>();
                 foreach (var c in vm.Cells)
                 {
                     if (c.Near(cell) && (c.State == CellState.Normal || c.State == CellState.Question))
                     {
                         c.PressState = PressState.Pressed;
                     }
                 }
             }
             else
             {
                 cell.PressState = PressState.Pressed;
             }
         }
     }
 }
Exemplo n.º 2
0
        private static void OnCellMouseLeave(object sender, MouseEventArgs e)
        {
            var vm = e.ExtractDataContext <ClearMineViewModel>();

            if (vm != null)
            {
                foreach (var c in vm.Cells)
                {
                    c.PressState = PressState.Released;
                }
            }
        }