private void MapGridCanvas_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (e.ClickCount == 1)
            {
                Point p = e.GetPosition((Canvas)sender);
                lastPosition = p;
                switch (mode)
                {
                case GameMapActionMode.SetOrigin:

                    p = p.Divide(UseScale);
                    map.CellOrigin = p;
                    //UpdateGridBrush();
                    break;

                case GameMapActionMode.SetFog:

                {
                    GameMap.MapCell cell = PointToCell(p);
                    if (CellOnBoard(cell))
                    {
                        List <GameMap.MapCell> list = PointToCellArray(p, brushSize);

                        newFogState = !map[cell.X, cell.Y];
                        foreach (var c in list)
                        {
                            if (CellOnBoard(c))
                            {
                                map[c.X, c.Y] = newFogState;
                            }
                        }
                        map.FireFogOrMarkerChanged();
                        settingFog = true;
                    }
                    break;
                }

                case GameMapActionMode.SetMarker:
                {
                    SetMarkers(p);
                    settingMarkers = true;
                }
                break;
                }
            }
            else if (e.ClickCount == 2)
            {
                if (fullscreen)
                {
                    ExitFullScreen();
                }
                else
                {
                    EnterFullScreen();
                }
            }
        }
        private void MapGridCanvas_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (e.ClickCount == 1)
            {
                Point p = e.GetPosition((Canvas)sender);
                lastPosition = p;
                switch (mode)
                {
                case GameMapActionMode.SetOrigin:

                    p = p.Divide(UseScale);
                    map.CellOrigin = p;
                    //UpdateGridBrush();
                    break;

                case GameMapActionMode.SetFog:

                {
                    GameMap.MapCell cell = PointToCell(p);
                    if (CellOnBoard(cell))
                    {
                        List <GameMap.MapCell> list = PointToCellArray(p, brushSize);

                        newFogState = !map[cell.X, cell.Y];
                        foreach (var c in list)
                        {
                            if (CellOnBoard(c))
                            {
                                map[c.X, c.Y] = newFogState;
                            }
                        }
                        map.FireFogOrMarkerChanged();
                        settingFog = true;
                    }
                    break;
                }

                case GameMapActionMode.SetMarker:
                {
                    SetMarkers(p);
                    settingMarkers = true;
                }
                break;
                }
            }
            else if (e.ClickCount == 2)
            {
                if (WindowState != WindowState.Maximized)
                {
                    WindowStyle = WindowStyle.None;
                    Topmost     = true;
                    WindowState = WindowState.Maximized;
                }
                else
                {
                    WindowStyle = WindowStyle.SingleBorderWindow;
                    Topmost     = false;
                    WindowState = WindowState.Normal;
                }
                Hide();
                Show();
            }
        }