Example #1
0
 public FormPopUp(FormMain frmMain)
 {
     InitializeComponent();
     _procMon = new ProcessMonitor(Settings.ProcessMonitor.ProcessOwner);
     _launcher = frmMain;
     Left = 0;
     //Rectangle r = Screen.PrimaryScreen.WorkingArea;
     //StartPosition = FormStartPosition.Manual;
     //Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - Width, Screen.PrimaryScreen.WorkingArea.Height - Height);
 }
Example #2
0
 public static void KillAll()
 {
     ProcessMonitor procMon = new ProcessMonitor(Settings.ProcessMonitor.ProcessOwner);
     procMon.Watch();
     List<string> dontKillThisApps = new List<string>(Regex.Split(Settings.ProcessMonitor.DontKillThisApp, ","));
     List<string> processToDelete = new List<string>();
     for (int i = 0; i < procMon._processList.Count ;i++)
     {
         string processName = procMon._processList[i];
         if( !dontKillThisApps.Any(item => item.Contains(processName)) )
         {
             processToDelete.Add(processName);//procMon._processList.RemoveAt(i);
         }
     }
     Process.GetProcesses().Where(p => processToDelete.Contains(p.ProcessName)).ToList().ForEach(y => y.Kill());
     Process.Start("shutdown.exe", "/l /f");
 }