private void btnTimetable_Click(object sender, RoutedEventArgs e) { var scheduleRepository = new SqlScheduleRepository(_connectionString); var timeTableWindow = new ScheduleWindow(_customer, scheduleRepository.SelectAll()); wndMainWindow.IsEnabled = false; timeTableWindow.ShowDialog(); wndMainWindow.IsEnabled = true; }
private void btnTimeTable_Click(object sender, RoutedEventArgs e) { var scheduleRepository = new SqlScheduleRepository(_connectionString); if (dgrDataRoutes.SelectedItem == null) { MessageBox.Show("Not selected route.", "Selection", MessageBoxButton.OK, MessageBoxImage.Error); return; } int routeId = ((Route)dgrDataRoutes.SelectedItem).Id; var scheduleWindow = new ScheduleWindow(_customer, scheduleRepository.GetTimeTableByRoute(routeId)); wndRoute.Close(); scheduleWindow.ShowDialog(); }