Exemple #1
0
        private void ShowProcess(Process process, bool isCreatedFromGui = false)
        {
            var processItem = new ProcessViewModel(process, isCreatedFromGui);

            processItem.Exited += Process_Exited;
            this.tab1ViewModel.AddProcess(processItem);
        }
Exemple #2
0
 internal void AddProcess(ProcessViewModel processItem)
 {
     lock (this.processLock)
     {
         this.proceses.Add(processItem);
     }
 }
Exemple #3
0
 internal void RemoveProcess(ProcessViewModel processItem)
 {
     lock (this.processLock)
     {
         if (this.proceses.Contains(processItem))
         {
             this.proceses.Remove(processItem);
         }
     }
 }
Exemple #4
0
        private void Select(object obj)
        {
            var process = obj as ProcessViewModel;

            Task.Run(() =>
            {
                process?.StartWatching();
            });
            SelectedItem?.StopWatching();
            SelectedItem = process;
        }
Exemple #5
0
 private void RefreshProcess(object sender, EventArgs e)
 {
     Process[] proceses = Process.GetProcesses();
     foreach (var process in proceses)
     {
         ProcessViewModel processVM = tab1ViewModel.Find(process.Id);
         if (processVM == null)
         {
             ShowProcess(process);
         }
     }
 }
Exemple #6
0
 private void Process_Exited(ProcessViewModel processVM)
 {
     if (!Application.Current.Dispatcher.CheckAccess())
     {
         Application.Current.Dispatcher.BeginInvoke(new Action(() => Process_Exited(processVM)));
     }
     else
     {
         this.tab1ViewModel.RemoveProcess(processVM);
         this.tab2ViewModel.RemoveProcess(processVM);
         processVM.Dispose();
     }
 }