private void DGV_Service_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { if (RoleType == "Administrator" || RoleType == "Manager") { if (DGV_Service.Items.IsEmpty) { AddService adserv = new AddService(); Service_page.Navigate(adserv); } else { upserv = new UpdateService(); object item = DGV_Service.SelectedItem; upserv.txt_CustCar.Text = (DGV_Service.SelectedCells[1].Column.GetCellContent(item) as TextBlock).Text; upserv.txt_Prob.Text = (DGV_Service.SelectedCells[3].Column.GetCellContent(item) as TextBlock).Text; if ((DGV_Service.SelectedCells[4].Column.GetCellContent(item) as TextBlock).Text == "On hold") { upserv.Rad_Hold.IsChecked = true; } else if ((DGV_Service.SelectedCells[4].Column.GetCellContent(item) as TextBlock).Text == "In process") { upserv.Rad_Process.IsChecked = true; } else if ((DGV_Service.SelectedCells[4].Column.GetCellContent(item) as TextBlock).Text == "Completed") { upserv.Rad_Done.IsChecked = true; } ID = (DGV_Service.SelectedCells[0].Column.GetCellContent(item) as TextBlock).Text; upserv.ID = ID; Service_page.Navigate(upserv); } } else { } } catch (ArgumentNullException) { } }
private void Can_AddService_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { Viewservice = new ViewService(); Addservice = new AddService(); Viewservice.Service_page = null; DependencyObject currParent = VisualTreeHelper.GetParent(this); while (currParent != null && Viewservice.Service_page == null) { Viewservice.Service_page = currParent as Frame; currParent = VisualTreeHelper.GetParent(currParent); } if (Viewservice.Service_page != null) { Viewservice.Service_page.Source = new Uri("AddService.xaml", UriKind.Relative); } }