private void OnMenuItem_Delete(object sender, RoutedEventArgs e) { if (this.treeView1.SelectedItem is RentalBuildingSingleYear) { RentalBuildingSingleYear toDelete = this.treeView1.SelectedItem as RentalBuildingSingleYear; if (toDelete != null) { if (MessageBoxEx.Show("Delete " + toDelete.Period, "Rental", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { toDelete.Building.Years.Remove(toDelete.Year); this.treeView1.Items.Refresh(); } } } else { if (this.treeView1.SelectedItem is RentBuilding) { RentBuilding toDelete = this.treeView1.SelectedItem as RentBuilding; if (MessageBoxEx.Show("Delete " + toDelete.Name, "Rental", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { myMoney.Buildings.RemoveBuilding(toDelete); } } } }
private void OnMenuItem_Edit(object sender, RoutedEventArgs e) { RentBuilding x = this.treeView1.SelectedItem as RentBuilding; if (x != null) { EditProperties(x); } }
bool EditProperties(RentBuilding a) { Walkabout.Dialogs.BuildingDialog dialog = new Dialogs.BuildingDialog(myMoney); dialog.TheBuilding = a; dialog.Owner = Application.Current.MainWindow; if (dialog.ShowDialog() == true) { return(true); } return(false); }
public void SetViewToRentBuilding(RentBuilding value) { this.Building = value; this.BuildingName = value.Name; this.Period = value.Period; this.TotalIncomes = value.TotalIncome; this.TotalExpensesTaxes = value.TotalExpense.TotalTaxes; this.TotalExpensesRepairs = value.TotalExpense.TotalRepairs; this.TotalExpensesManagement = value.TotalExpense.TotalManagement; this.TotalExpensesMaintenance = value.TotalExpense.TotalMaintenance; this.TotalExpensesInterest = value.TotalExpense.TotalInterest; UpdateAllDataBindings(); }
private void OnMenuNewRental_Click(object sender, RoutedEventArgs e) { RentBuilding rb = new RentBuilding(this.MyMoney.Buildings); rb.Name = "New Rental"; if (rb != null) { if (EditProperties(rb) == true) { this.MyMoney.Buildings.Add(rb); ReloadTreeView(); } } }