private void BtnNew_Click(object sender, RoutedEventArgs e) { // Invokes a new company form CompanyForm CompanyForm = new CompanyForm("Add Company", "Add"); CompanyForm.Owner = this; CompanyForm.DataContext = null; CompanyForm.ShowDialog(); }
private void BtnDelete_Click(object sender, RoutedEventArgs e) { // Invokes a company form with the selected company in the list view as context, that is to be deleted if confirmed. if (lvwCompanies.SelectedItem != null) { CompanyForm CompanyForm = new CompanyForm("Delete Company - Are you sure?", "Delete"); CompanyForm.DataContext = (Company)lvwCompanies.SelectedItem; CompanyForm.Owner = this; CompanyForm.ShowDialog(); } }
private void BtnEdit_Click(object sender, RoutedEventArgs e) { // Invokes an editable company form with the selected company in the list view as context. if (lvwCompanies.SelectedItem != null) { CompanyForm CompanyForm = new CompanyForm("Edit Company", "Edit"); CompanyForm.DataContext = (Company)lvwCompanies.SelectedItem; CompanyForm.Owner = this; CompanyForm.ShowDialog(); } }
private void BtnView_Click(object sender, RoutedEventArgs e) { // Invokes a company form with the fields disabled for viewing purposes only. if (lvwCompanies.SelectedItem != null) { Company Company = (Company)lvwCompanies.SelectedItem; CompanyForm CompanyForm = new CompanyForm(Company.Name, "View"); CompanyForm.DataContext = Company; CompanyForm.Owner = this; CompanyForm.ShowDialog(); } }