Ejemplo n.º 1
0
 private void menuItem2_Click(object sender, System.EventArgs e)
 {
     try
     {
         objnewprocess = new frmnewprcdetails();
         objnewprocess.ShowDialog();
         if (newprocpathandparm.Length != 0)
         {
             if (newprocpathandparm.IndexOf("\\") == -1)
             {
                 string[] newprocdetails = newprocpathandparm.Split(' ');
                 if (newprocdetails.Length > 1)
                 {
                     Process newprocess = Process.Start(newprocdetails[0].ToString(), newprocdetails[1].ToString());
                 }
                 else
                 {
                     Process newprocess = Process.Start(newprocdetails[0].ToString());
                 }
             }
             else
             {
                 string   procname       = newprocpathandparm.Substring(newprocpathandparm.LastIndexOf("\\") + 1);
                 string[] newprocdetails = procname.Split(' ');
                 if (newprocdetails.Length > 1)
                 {
                     Process newprocess = Process.Start(newprocpathandparm.Replace(newprocdetails[1].ToString(), ""), newprocdetails[1].ToString());
                 }
                 else
                 {
                     Process newprocess = Process.Start(newprocpathandparm);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Ejemplo n.º 2
0
 private void menuItem7_Click(object sender, System.EventArgs e)
 {
     try
     {
         string caption = "Enter Machine Name";
         objnewprocess = new frmnewprcdetails(caption);
         if (objnewprocess.ShowDialog() != DialogResult.Cancel)
         {
             t.Dispose();
             presentprocdetails.Clear();
             lvprocesslist.Items.Clear();
             LoadAllProcessesOnStartup();
             if (frmmain.mcname == ".")
             {
                 frmmain.objtaskmgr.Text = "Task Manager Connected to Local";
                 menuItem3.Visible       = true;
                 menuItem9.Visible       = true;
                 menuItem2.Visible       = true;
                 menuItem10.Visible      = true;
             }
             else
             {
                 frmmain.objtaskmgr.Text = "Task Manager Connected to " + frmmain.mcname;
                 menuItem3.Visible       = false;
                 menuItem9.Visible       = false;
                 menuItem2.Visible       = false;
                 menuItem10.Visible      = false;
             }
             System.Threading.TimerCallback timerDelegate =
                 new System.Threading.TimerCallback(this.LoadAllProcesses);
             t = new System.Threading.Timer(timerDelegate, null, 1000, 1000);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }