Пример #1
0
        public static void Send(Arguments args)
        {
            try
            {
                IpcChannel ipcCh = new IpcChannel("myClient");
                ChannelServices.RegisterChannel(ipcCh, false);

                SingletonController ctrl = (SingletonController)Activator.GetObject(
                    typeof(SingletonController),
                    "ipc://IPChannelName/SingletonController");

                ctrl.Receive(args);

                ctrl = null;

                ChannelServices.UnregisterChannel(ipcCh);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: " + e.Message);
                throw;
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            Arguments arguments = new Arguments(args);

            if (arguments.NeedHelp())
            {
                ShowUsage();
                return;
            }

            if (string.IsNullOrEmpty(arguments["vpath"]))
            {
                arguments["vpath"] = "/";
            }

            if (SingletonController.IamFirst(controller_Received))
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                if (arguments.SomePassed())
                {
                    frm = new frmMain(arguments["port"], arguments["vpath"], arguments["path"]);
                }
                else
                {
                    frm = new frmMain();
                }

                Application.Run(frm);
            }
            else
            {
                SingletonController.Send(arguments);
            }
        }