Ejemplo n.º 1
0
 void ProcessStop(object sender, ProcessEventArgs e)
 {
     if (processes.ContainsKey(e.ProcessID))
     {
         Process proc = null;
         while (proc == null)
         {
             processes.TryRemove(e.ProcessID, out proc);
         }
     }
     if (!Dispatcher.CheckAccess())
     {
         Dispatcher.Invoke(this.UpdateProcessList);
     }
 }
Ejemplo n.º 2
0
        void ProcessStart(object sender, ProcessEventArgs e)
        {
            bool gettedProcess = true;

            try
            {
                Process newProcess = Process.GetProcessById(e.ProcessID);
                bool    added      = false;
                while (!added)
                {
                    added = this.processes.TryAdd(newProcess.Id, newProcess);
                }
            }
            catch (Exception)
            {
                gettedProcess = false;
            }
            if (gettedProcess && !Dispatcher.CheckAccess())
            {
                Dispatcher.Invoke(this.UpdateProcessList);
            }
        }