Exemple #1
0
        /// <summary>
        /// Constructeur complet
        /// </summary>
        /// <param name="width">Largeur (nombre de colonnes)</param>
        /// <param name="height">Hauteur (nombre de lignes)</param>
        public Grid(int width, int height)
        {
            this.viewModel = new ViewModels.Grid(width, height);
            cells          = new Cell[viewModel.Width, viewModel.Height];

            Init();
            patterns = new ViewModels.Pattern();

            this.VerticalAlignment   = VerticalAlignment.Center;
            this.HorizontalAlignment = HorizontalAlignment.Center;
        }
        /// <summary>
        /// Appelé lorsque le bouton de redimensionnement est clické
        /// </summary>
        /// <param name="sender">objet appelant cet méthode</param>
        /// <param name="args">arguments lié à l'événement</param>
        private void buttonSize_Click(object sender, RoutedEventArgs args)
        {
            ViewModels.Grid viewModel = view.ViewModel;
            int             width     = numberWidth.GetValue();
            int             height    = numberHeight.GetValue();

            if (viewModel.Width != width || viewModel.Height != height)
            {
                SetGrid(view.Resize(width, height));
                view.ChangeSize(panelGrid.ActualWidth, panelGrid.ActualHeight);
            }
        }