Exemplo n.º 1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            //only one
            WpfHelper.AppIsOnlyRun();

            //engine
            EngineHelper.Worker.Startup(appHosting);
            EngineHelper.Worker.OnStart();
            base.OnStartup(e);

            //server
            var process = WpfHelper.AppServerStart(AppHelper.ServerName, AppHelper.ServerPath, AppHelper.ServerObj, isOnly: true);
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            //events
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

            //only one
            WpfHelper.AppIsOnlyRun();

            //hosting
            var appHosting = new AppHosting();

            //engine
            EngineHelper.Worker.Startup(appHosting);
            EngineHelper.Worker.OnStart();

            // 创建一个IPC信道 注册这个IPC信道. 向信道暴露一个远程对象.
            IpcServerChannel serverChannel = new IpcServerChannel("channel");

            ChannelServices.RegisterChannel(serverChannel, false);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(ServerMarshalByRefObject), "ServerMarshalByRefObject.rem", WellKnownObjectMode.Singleton);

            #region  打印这个信道的名称. 优先级. URI数组

            Console.WriteLine("The name of the channel is {0}.", serverChannel.ChannelName);
            Console.WriteLine("The priority of the channel is {0}.", serverChannel.ChannelPriority);
            foreach (string uri in ((ChannelDataStore)serverChannel.ChannelData).ChannelUris)
            {
                Console.WriteLine("The channel URI is {0}.", uri);
            }

            #endregion

            Console.WriteLine("UTH.Meeting.Server started.");
            Console.WriteLine("Press ENTER to exit the server.");
            Console.ReadLine();
        }