/// <summary> /// Remove selected from the Listview item /// </summary> private void removeItem() { // Escape if their is no selection if (JobsDataGrid.SelectedIndex == -1) { return; } // get the current selection int selectedIndex = JobsDataGrid.SelectedIndex; // Remmove the selected Item Jobs.RemoveAt(JobsDataGrid.SelectedIndex); // Change the Selected index if (Jobs.Count <= selectedIndex) { selectedIndex--; } // Set the new Selection JobsDataGrid.SelectedIndex = selectedIndex; // Set the Focus to the Object. So we see the right Selection color JobsDataGrid.Focus(); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void StartPausSim_CommandEventHandler(object sender, ExecutedRoutedEventArgs e) { switch (currentSimulationState) { case Simulation_State.Stop: // Try to exit the Edit Mode of the Cell JobsDataGrid.CommitEdit(); JobsDataGrid.SelectedIndex = -1; JobsDataGrid.CommitEdit(); simulationInterface.RequestStateChange(Simulation_State.Run, Jobs); break; case Simulation_State.Pause: simulationInterface.RequestStateChange(Simulation_State.Run); break; case Simulation_State.Run: simulationInterface.RequestStateChange(Simulation_State.Pause); break; } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SaveSim_CommandEventHandler(object sender, ExecutedRoutedEventArgs e) { // Try to exit the Edit Mode of the Cell JobsDataGrid.CommitEdit(); JobsDataGrid.SelectedIndex = -1; JobsDataGrid.CommitEdit(); LinkedList<Simulation_Job> simulationJobs = new LinkedList<Simulation_Job>(); foreach (Simulation_Job jobItem in Jobs) { simulationJobs.AddLast(jobItem); } Simulation_ImportExport mySimulationExporter = new Simulation_ImportExport(); mySimulationExporter.ExportSimulationDataToFileSystem(simulationJobs); }
private void Order_ToJobButton_Click(object sender, RoutedEventArgs e) { var itemEntry = (CustomerOrderFullPOCO)CustomerOrdersDatagrid.SelectedItem; foreach (var item in JobsDataGrid.Items) { if (((FullJobPOCO)item).Id == itemEntry.Job.Id) { JobsDataGrid.SelectedItem = item; JobsDataGrid.ScrollIntoView(item); JobsDataGrid.Focus(); break; } } JobsFilterCompleted.IsChecked = false; JobsFilterWaitingComplete.IsChecked = false; JobsTab.IsSelected = true; JobsDataGrid_SelectionChanged(null, null); }