Ejemplo n.º 1
0
        private void Delete_Building(object sender, RoutedEventArgs e)
        {
            var res = MessageBox.Show(
                "Tem a certeza que deseja apagar o prédio " + p.ToString() + " do sistema ?",
                "Apagar prédio",
                MessageBoxButton.YesNo,
                MessageBoxImage.Question
                );

            if (res.ToString() == "Yes")
            {
                p.Delete();
                Buildings = new ObservableCollection <Predio>(Predio.get_All_Buildings());
                PropertyChanged(this, new PropertyChangedEventArgs(nameof(Buildings)));
                vm.Buildings            = Buildings;
                PushpinPopup.Visibility = Visibility.Hidden;
                MessageBox.Show(
                    "Prédio " + p.ToString() + " apagado com sucesso!",
                    "Apagar prédio",
                    MessageBoxButton.OK,
                    MessageBoxImage.Information
                    );

                p = null;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Default constructor
        /// </summary>
        public WindowViewModel(Window window)
        {
            mWindow = window;

            // Listen out for the window resizing
            mWindow.StateChanged += (sender, e) =>
            {
                // Fire off events for all properties that are affected by a resize
                WindowResized();
            };

            // Create commands
            MinimizeCommand = new RelayCommand(() => mWindow.WindowState = WindowState.Minimized);
            MaximizeCommand = new RelayCommand(() => mWindow.WindowState ^= WindowState.Maximized);
            CloseCommand    = new RelayCommand(() => mWindow.Close());
            V = new RelayCommand(() => { if (CurrentBuilding != null)
                                         {
                                             changeViewEnterB(CurrentBuilding);
                                         }
                                 });
            F = new RelayCommand(() => { if (CurrentBuilding != null)
                                         {
                                             changeViewFractions(CurrentBuilding);
                                         }
                                 });
            B = new RelayCommand(() => { if (CurrentBuilding != null)
                                         {
                                             changeViewFinancesPage(CurrentBuilding);
                                         }
                                 });
            C = new RelayCommand(() => { if (CurrentBuilding != null)
                                         {
                                             changeViewCondominosPage();
                                         }
                                 });
            Q = new RelayCommand(() => { if (CurrentBuilding != null)
                                         {
                                             changeviewQuotaPage(CurrentBuilding);
                                         }
                                 });
            A = new RelayCommand(() => { if (CurrentBuilding != null)
                                         {
                                             changeViewAgendaPage(CurrentBuilding);
                                         }
                                 });
            R = new RelayCommand(() => { if (CurrentBuilding != null)
                                         {
                                             changeViewReunionPage(CurrentBuilding);
                                         }
                                 });
            O = new RelayCommand(() => { if (CurrentBuilding != null)
                                         {
                                             changeViewOrcamentoPage(CurrentBuilding);
                                         }
                                 });
            M = new RelayCommand(() => { if (CurrentBuilding != null)
                                         {
                                             changeViewManutencaoPage(CurrentBuilding);
                                         }
                                 });


            Buildings = new ObservableCollection <Predio>(Predio.get_All_Buildings());

            // Fix window resize issue
            mWindowResizer = new WindowResizer(mWindow);

            // Listen out for dock changes
            mWindowResizer.WindowDockChanged += (dock) =>
            {
                // Store last position
                mDockPosition = dock;

                // Fire off resize events
                WindowResized();
            };


            pages = new List <UserControl>(new UserControl[Enum.GetNames(typeof(ApplicationPage)).Length]);

            changeViewInitialPage();
        }