private void switchCanvas(string canvasName) { switch (canvasName) { case "Active": TabCustomers.Focus(); CanViewAllCustomer.Visibility = Visibility.Visible; CanCustomerAdd.Visibility = Visibility.Hidden; CanCustomerEdit.Visibility = Visibility.Hidden; CanCustomerDeactive.Visibility = Visibility.Hidden; break; case "Add": TabAddCustomer.Focus(); CanViewAllCustomer.Visibility = Visibility.Hidden; CanCustomerAdd.Visibility = Visibility.Visible; CanCustomerEdit.Visibility = Visibility.Hidden; CanCustomerDeactive.Visibility = Visibility.Hidden; break; case "Edit": TabEditCustomer.Focus(); CanViewAllCustomer.Visibility = Visibility.Hidden; CanCustomerAdd.Visibility = Visibility.Hidden; CanCustomerEdit.Visibility = Visibility.Visible; CanCustomerDeactive.Visibility = Visibility.Hidden; break; case "Deactive": TabDeactiveCustomers.Focus(); CanViewAllCustomer.Visibility = Visibility.Hidden; CanCustomerAdd.Visibility = Visibility.Hidden; CanCustomerEdit.Visibility = Visibility.Hidden; CanCustomerDeactive.Visibility = Visibility.Visible; break; default: TabCustomers.Focus(); CanViewAllCustomer.Visibility = Visibility.Visible; CanCustomerAdd.Visibility = Visibility.Hidden; CanCustomerEdit.Visibility = Visibility.Hidden; CanCustomerDeactive.Visibility = Visibility.Hidden; break; } }
private void TabAddCustomer_GotFocus(object sender, RoutedEventArgs e) { //we need to retrieve regionsIds. So, the entry can choose the region from //drop list RegionsManagerInterface regionsManager = new RegionsManager(); List <Region> regions = regionsManager.retrieveAllRegions(); foreach (var item in regions) { comboCustomerAddRegionID.Items.Add(item.RegionId); } TabAddCustomer.Focus(); switchCanvas("Add"); }
/// <summary> /// on click on Insert buttom, we hid all other canvases and let /// Canvas of customerAdd to pop up /// </summary> /// <remarks> /// created by Awaab Elamin on 5/21/2020 /// </remarks> /// <param name="sender"></param> /// <param name="e"></param> private void btnCustomerInsert_Click(object sender, RoutedEventArgs e) { //we need to retrieve regionsIds. So, the entry can choose the region from //drop list RegionsManagerInterface regionsManager = new RegionsManager(); List <Region> regions = regionsManager.retrieveAllRegions(); foreach (var item in regions) { comboCustomerAddRegionID.Items.Add(item.RegionId); } CanViewAllCustomer.Visibility = Visibility.Hidden; CanCustomerAdd.Visibility = Visibility.Visible; TabAddCustomer.Focus(); //if (DGCustomerView.SelectedItem == null) //{ // lblCustomerError.Content = "AWaab"; // return; //} //Customer customer = (Customer)DGCustomerView.SelectedItem; //lblCustomerError.Content = ""; }