public void toSaveData(AllProcess allProcess) { foreach (var process in Process.GetProcesses()) { ProcessingProgram p = new ProcessingProgram(process); allProcess.ListOfProcesses.Add(p); } }
private void dataGrid1_MouseDoubleClick(object sender, MouseButtonEventArgs e) { processingProgram = (ProcessingProgram)dataGrid1.SelectedItem; processingProgram.refreshProcess(processingProgram); textCPU.Text = $"CPU usage:\n{processingProgram.CPU}"; textMemory.Text = $"Memory usage:\n{processingProgram.Memory}"; textStartTime.Text = $"Start Time:\n{processingProgram.StartTime}"; textRunningTime.Text = $"Running Time: \n{processingProgram.RunningTime}"; textComment.Text = $"{processingProgram.Comment}"; }
private void dataGrid1_SelectionChanged(object sender, SelectionChangedEventArgs e) { processingProgram = (ProcessingProgram)dataGrid1.SelectedItem; if (processingProgram != null) { textCPU.Text = $"CPU usage:\n{processingProgram.CPU}"; textMemory.Text = $"Memory usage:\n{processingProgram.Memory}"; textStartTime.Text = $"Start Time:\n{processingProgram.StartTime}"; textRunningTime.Text = $"Running Time: \n{processingProgram.RunningTime}"; } }
private void buttonAddComment_Click(object sender, RoutedEventArgs e) { try { processingProgram = (ProcessingProgram)dataGrid1.SelectedItem; Utility.AddComent(processingProgram, CommentBox.Text); MessageBox.Show("Comment added."); } catch (Exception) { MessageBox.Show("You have to select an item first!"); } finally { CommentBox.Text = ""; } }
private void buttonList_Click(object sender, RoutedEventArgs e) { if (!onlineModeTimer.IsEnabled) { AllProcess allProcess = new AllProcess(); processesListed = true; dataGrid1.ItemsSource = allProcess.ListOfProcesses; foreach (var process in Process.GetProcesses()) { processingProgram = new ProcessingProgram(process); allProcess.ListOfProcesses.Add(processingProgram); } dataGrid1.Visibility = Visibility.Visible; } else { MessageBox.Show("Turn off online mode first!", "Warning"); } }