public FractionsPage(WindowViewModel vm, Predio p) { InitializeComponent(); this.vm = vm; this.p = p; List <Fracao> fractions = Fracao.get_All_Fractions(p.ID); int oc = 0; foreach (Fracao fraction in fractions) { _Items.Add(fraction); if (fraction.CurrentCondomino != null) { oc += 1; } } if (fractions.Count() != 0) { Ocupacao = (Math.Round(100 * oc / (double)fractions.Count(), 2)).ToString() + "% (" + oc + "/" + fractions.Count() + ")"; } else { Ocupacao = "0% (" + oc + "/" + fractions.Count() + ")"; } }
public BuildingMainPage(WindowViewModel vm, Predio p) { InitializeComponent(); this.vm = vm; this.p = p; Map.Center = p.Location; IntervalTimer = Convert.ToInt32(ConfigurationManager.AppSettings["IntervalTime"]); strImagePath = ConfigurationManager.AppSettings["ImagePath"] + "/Predio_" + p.ID; ImageControls = new[] { myImage, myImage2 }; LoadImages(); timerImageChange = new DispatcherTimer(); timerImageChange.Interval = new TimeSpan(0, 0, IntervalTimer); timerImageChange.Tick += new EventHandler(timerImageChange_Tick); List <Fracao> fractions = Fracao.get_All_Fractions(p.ID); foreach (Fracao fraction in fractions) { Fractions.Add(fraction); if (fraction.CurrentCondomino != null) { ocupacao += 1; } } Eventos = new ObservableCollection <Evento>(Evento.get_Next_Events(p.ID)); showColumnChart(); }
private void DeleteFrac(object sender, RoutedEventArgs e) { var res = MessageBox.Show( "Tem a certeza que deseja apagar a fração do sistema ?", "Apagar fração", MessageBoxButton.YesNo, MessageBoxImage.Question ); if (res.ToString() == "Yes") { ((Fracao)FractionGrid.SelectedItem).Delete(); _Items = new ObservableCollection <Fracao>(Fracao.get_All_Fractions(p.ID)); PropertyChanged(this, new PropertyChangedEventArgs(nameof(Items))); MessageBox.Show( "Fração apagada com sucesso!", "Apagar fração", MessageBoxButton.OK, MessageBoxImage.Information ); } }