Exemplo n.º 1
0
        private void Controller_Click(object sender, RoutedEventArgs e)
        {
            Update();
            GridPoint ctrl = (GridPoint)sender;

            if (ctrl.Background == System.Windows.Media.Brushes.Transparent)
            {
                MonteCarlo.SetPoint(ctrl);
                Update();
                ctrl.selected   = true;
                ctrl.Background = Graphics.SettingBackground(Graphics.Ikony.joker);
            }
            else
            {
                MonteCarlo.UncheckPoint(ctrl);
                Update();
                ctrl.Background = System.Windows.Media.Brushes.Transparent;
                ctrl.selected   = false;
            }
        }
Exemplo n.º 2
0
        public Map(MainWindow mw, int GridS, int height, int width)
        {
            MainWin = mw;

            gridSize   = GridS;
            Gridheight = height / GridS;
            Gridwidth  = width / GridS;

            MainWin.Title      = "Artificial Intelligence Camouflage";
            MainWin.Height     = height + 75;
            MainWin.Width      = width + 15;
            MainWin.ResizeMode = ResizeMode.NoResize;
            MainWin.Background = new ImageBrush(new BitmapImage(new Uri(@"pack://application:,,,/images/mapa.png")));

            Grid = new List <List <GridPoint> >();

            for (int i = 0; i < GridS; i++)
            {
                List <GridPoint> SubList = new List <GridPoint>();
                for (int j = 0; j < GridS; j++)
                {
                    GridPoint button = new GridPoint();
                    button.X               = Gridwidth * j + Gridwidth / 2;
                    button.Y               = Gridheight * i + Gridheight / 2;
                    button.Height          = Gridheight;
                    button.Width           = Gridwidth;
                    button.Background      = Brushes.Transparent;
                    button.BorderThickness = new Thickness(0, 0, 0, 0);

                    button.MouseEnter += MenuController.Hovering;
                    button.MouseLeave += MenuController.Out;


                    Canvas.SetTop(button, i * Gridheight);
                    Canvas.SetLeft(button, j * Gridwidth);
                    MainWin.root.Children.Add(button);
                    SubList.Add(button);
                }
                Grid.Add(SubList);
            }
        }
Exemplo n.º 3
0
 public void UncheckPoint(GridPoint OdznaczanyPunkt)
 {
     ZaznaczonePunkty.Remove(OdznaczanyPunkt);
 }
Exemplo n.º 4
0
 public void SetPoint(GridPoint WybranyPunkt)
 {
     ZaznaczonePunkty.Add(WybranyPunkt);
 }