示例#1
0
        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!
            }
        }
示例#2
0
 private static void OnApplicationExit(object sender, EventArgs e)
 {
     PipeServer.Stop();
 }