Exemplo n.º 1
0
        public void KillProcess(string processName)
        {
            var find = ProcessList.Find(t => t.Name == processName);

            if (find == null)
            {
                find = SuspendedList.Find(t => t.Name == processName);
                if (find == null)
                {
                    throw new ProcessNotExistException()
                          {
                              Name = processName
                          };
                }
                else
                {
                    SuspendedList.Remove(find);
                    OnProcessKilled(find);
                }
            }
            else
            {
                ProcessList.Remove(find);
                OnProcessKilled(find);
            }
        }
Exemplo n.º 2
0
        public void ResumeProcess(string processName)
        {
            var find = SuspendedList.Find(t => t.Name == processName);

            if (find != null)
            {
                SuspendedList.Remove(find);
                find.State = State.Ready;
                ProcessList.Add(find);
                OnProcessStateChange(find, State.Suspended);
            }
            else
            {
                throw new ProcessNotExistException()
                      {
                          Name = processName
                      };
            }
        }