Exemplo n.º 1
0
        //static void starter_StandardOut(object sender, StandardOutArg e)
        //{
        //    Console.WriteLine("standout=>" + e.ProcessId + "=>" + e.OutPut);
        //}

        //static void starter_StandardErrorOut(object sender, StandardErrorArg e)
        //{
        //    Console.WriteLine("error=>" + e.ProcessId + "=>" + e.OutPut);
        //}

        private void button2_Click(object sender, EventArgs e)
        {
            string filename =
                @"..\..\..\Dev.ProcessMonitor.TestTargerExe\bin\Debug\Dev.ProcessMonitor.TestTargerExe.exe";
            string arg = "";


            _processStarterSync = new ProcessStarterSync(filename, arg);
            _processStarterSync.StandardErrorOut += starter_StandardErrorOut;
            _processStarterSync.StandardOut += starter_StandardOut;
            _processStarterSync.Finished += starter_Finished;
            _processStarterSync.StartSync();
        }
Exemplo n.º 2
0
        public void MyTestMethod()
        {
            string filename =
                @"..\..\..\Dev.ProcessMonitor.TestTargerExe\bin\Debug\Dev.ProcessMonitor.TestTargerExe.exe";
            string arg = "";


            var _processStarterSync = new ProcessStarterSync(filename, arg);
            //_processStarterSync.StandardErrorOut += starter_StandardErrorOut;
            //_processStarterSync.StandardOut += starter_StandardOut;
            //_processStarterSync.Finished += starter_Finished;
            _processStarterSync.StartSync();

            Process[] pro = Process.GetProcessesByName("Dev.ProcessMonitor.TestTargerExe");

            foreach (Process process in pro)
            {
                bool isrunn = ProcessManager.IsProcessRunning(process.Id);

                bool isRespding = ProcessManager.IsProcessResponding(process.Id);
            }
        }