public void SaveComment(DataGrid DataGridXML, TextBox ProcessNote) { CurrentlyRunningProcess process = (CurrentlyRunningProcess)DataGridXML.SelectedItem; string note = ProcessNote.Text; process.addNote(note); }
public List <CurrentlyRunningProcess> CreateProcessInstance() { List <CurrentlyRunningProcess> ListOfProcesses = new List <CurrentlyRunningProcess>(); try { Process[] AllProcesses = Process.GetProcesses(); List <string> AllCpuUsages = GetCPUUsage(AllProcesses); for (int i = 0; i < AllCpuUsages.Count; i++) { var name = AllProcesses[i].ProcessName.ToString(); var cpuUsage = AllCpuUsages[i]; var memoryUsage = Math.Round(AllProcesses[i].PrivateMemorySize64 * (1 * (Math.Pow(10.0, -6))), 2).ToString() + " MB"; var runTime = (DateTime.Now - AllProcesses[i].StartTime).ToString(); var startTime = AllProcesses[i].StartTime.ToString(); CurrentlyRunningProcess temporarympProcess = new CurrentlyRunningProcess(name, cpuUsage, memoryUsage, runTime, startTime); ListOfProcesses.Add(temporarympProcess); } return(ListOfProcesses); } catch (Exception e) { Console.WriteLine(e.ToString()); return(ListOfProcesses); } }
public void SearchOnWeb(DataGrid DataGridXML) { CurrentlyRunningProcess process = (CurrentlyRunningProcess)DataGridXML.SelectedItem; try { string searchQuery = process.name; System.Diagnostics.Process.Start("https://www.google.com/search?q=" + Uri.EscapeDataString(searchQuery)); } catch (System.NullReferenceException exception) { Console.WriteLine(exception.ToString()); } }
public void ShowProcessDetails(ListBox ProcessDetailsXML, TextBox ProcessNote, DataGrid DataGridXML) { try { ProcessDetailsXML.Items.Clear(); ProcessNote.Text = String.Empty; CurrentlyRunningProcess process = (CurrentlyRunningProcess)DataGridXML.SelectedItem; ProcessDetailsXML.Items.Add(process.ToString()); ProcessNote.Text = process.note; } catch (System.NullReferenceException exception) { Console.WriteLine(exception.ToString()); } }
public void RefreshOnDoubleClick(DataGrid DataGridXML, TextBox ProcessNote, ListBox ProcessDetailsXML) { CurrentlyRunningProcess process = (CurrentlyRunningProcess)DataGridXML.SelectedItem; ProcessDetailsXML.Items.Clear(); processes.EmptyContainer(); DataGridXML.Items.Clear(); processes.getAllRunningProcess(); VisualizeProcesses(DataGridXML); try { ProcessDetailsXML.Items.Add(process.ToString()); } catch (System.NullReferenceException c) { Console.WriteLine(c.ToString()); } }
/// <summary> /// Gets the process to run and allows it to run. /// </summary> public void Process() { PrintInformation("Beginning cycle."); if (Dispatcher.IsPreemptive() && Dispatcher.ShouldPreempt(this, _system)) { var preemptedProcess = CurrentlyRunningProcess; GetAppropriateQueue().Enqueue(preemptedProcess); CurrentlyRunningProcess = null; PrintInformation("Preempted Process."); } if (IsIdling) { PrintInformation("Idling..."); CurrentlyRunningProcess = Dispatcher.Dispatch(this, GetAppropriateQueue()); } Thread.Sleep(Constants.ClockPeriod); var processHasCompleted = CurrentlyRunningProcess != null && CurrentlyRunningProcess.Run(CurrentClockCycle); Dispatcher.UpdateOnClockCycle(); if (processHasCompleted) { PrintInformation("Current process has completed."); ProcessesSeen++; CurrentlyRunningProcess.CalculateStatistics(out var processStats); _statisticHistory.Add(processStats); CurrentlyRunningProcess = null; } PrintInformation("Completed cycle."); CurrentClockCycle += 1; }
public void addNewProcess(CurrentlyRunningProcess process) { processes.Add(process); }