private AddItemPage ViewObject <T>(bool isOpenable, T obj) { AddItemPage viewPage = OpenViewPage(isOpenable); if (viewPage != null) { viewPage.AddObj(obj); return(viewPage); } return(null); }
private AddItemPage OpenViewPage(bool isOpenable) { if (isOpenable) { AddItemPage itemPage = new AddItemPage((int)searchType); adminWindow.ChangeFrame(itemPage); return(itemPage); } return(null); }
private void EditBtn_Click(object sender, RoutedEventArgs e) { bool isOpenable = true; switch (searchType) { case (SearchType.Property): if (propertyComboBox.SelectedItem == null) { MessageBox.Show("Please select a property before trying to view/edit!"); isOpenable = false; } ViewObject(isOpenable, ((Property)propertyComboBox.SelectedItem)); break; case (SearchType.District): if (districtComboBox.SelectedItem == null) { MessageBox.Show("Please select a district before trying to view/edit!"); isOpenable = false; } ViewObject(isOpenable, ((District)districtComboBox.SelectedItem)); break; case (SearchType.Neighbourhood): if (neighbourComboBox.SelectedItem == null) { MessageBox.Show("Please select a neighbourhood before trying to view/edit!"); isOpenable = false; } else { AddItemPage viewPage = ViewObject(isOpenable, ((Neighbourhood)neighbourComboBox.SelectedItem)); if (viewPage != null) { viewPage.SetDistrictName(districtComboBox.Text); } } break; } }