static void Main(string[] args) { bool ok; System.Threading.Mutex m = new System.Threading.Mutex(true, "__MSDN_HV2VIEWER_LADSOFT__", out ok); if (!ok) { if (args.Length == 1) { PipeClient.Write(args[0]); } } else { AppDomain currentDomain = AppDomain.CurrentDomain; currentDomain.AssemblyResolve += new ResolveEventHandler(ResolveAssembly); Application.ApplicationExit += OnApplicationExit; PipeServer.Start(PipeServerCallback); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); mainWindow = new Form1(args); Application.Run(mainWindow); GC.KeepAlive(m); // important! } }
public static void Stop() { PipeClient.Write("*stop*"); }