コード例 #1
0
        private static void StopClient()
        {
            try
            {
                Process[] processes = Process.GetProcessesByName("MP2-Client");
                if (processes.Length == 0)
                {
                    return;
                }

                // If process is running, send an IPC command to force closing.
                using (var client = new IpcClient("Client"))
                {
                    client.Connect();
                    client.ShutdownApplication(2000, true);
                }
            }
            catch (Exception ex)
            {
                ServiceRegistration.Get <ILogger>().Error("MP2-Client.exe couldn't be started.", ex);
            }
        }