Beispiel #1
0
        public void TestLaunchProcessAndTerminate()
        {
            NSRunningApplication app = LaunchServices.OpenApplicationInternal(new ApplicationStartInfo("/Applications/Calculator.app"));

            try {
                Assert.IsNotNull(app);
                Assert.That(app.ProcessIdentifier, Is.GreaterThan(-1));
            } finally {
                Assert.IsTrue(app.Terminate(), "Could not kill Calculator app");
            }
        }
Beispiel #2
0
        public static bool KillProcess(int pid)
        {
            NSRunningApplication runningApp = NSRunningApplication.GetRunningApplication(pid);

            if (runningApp == null)
            {
                return(false);
            }

            return(runningApp.Terminate());
        }