예제 #1
0
파일: Program.cs 프로젝트: 5509850/baumax
        static void Main(string[] args)
        {
            try
            {
                DefaultDiction.BuildDefaultResource();
                ClientEnvironment.IsRuntimeMode = true;
                RemotingConfiguration.Configure("Baumax.TestClient.exe.config", false);
                GenuineGlobalEventProvider.GenuineChannelsGlobalEvent += GenuineGlobalEventProvider_GenuineChannelsGlobalEvent;

                // Define channel security
                IEnumerator channelEnum = ChannelServices.RegisteredChannels.GetEnumerator();
                while (channelEnum.MoveNext())
                {
                    BasicChannelWithSecurity channel = channelEnum.Current as BasicChannelWithSecurity;
                    if (channel != null)
                    {
                        channel.ITransportContext.IKeyStore.SetKey("/BAUMAX/SES", new KeyProvider_SelfEstablishingSymmetric());
                    }
                }

                DoLogin();
                FullTest test = new FullTest();
                for (; ;)
                {
                    test.Run();
                }
            }
            catch (Exception ex)
            {
                Console.Out.WriteLine(ex.ToString());
                Console.In.ReadLine();
            }
        }
예제 #2
0
        protected override void OnStart(string[] args)
        {
            log.Info("Starting...");
            try
            {
                //Set current directory to assembly folder
                System.Environment.CurrentDirectory =
                    System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);

                ServerStateService svcState = new ServerStateService();
                RemotingServices.Marshal(svcState, "rServerStateService");
                svcState.AfterPropertiesSet();

                // Force Spring to load configuration
                ContextRegistry.GetContext();

                // Define channel security
                IEnumerator channelEnum = ChannelServices.RegisteredChannels.GetEnumerator();
                while (channelEnum.MoveNext())
                {
                    BasicChannelWithSecurity channel = channelEnum.Current as BasicChannelWithSecurity;
                    if (channel != null)
                    {
                        channel.ITransportContext.IKeyStore.SetKey("/BAUMAX/SES",
                                                                   new KeyProvider_SelfEstablishingSymmetric());
                    }
                }

                Baumax.AppServer.Environment.ServerEnvironment.Configure();

                Scheduler.Scheduler sch = new Scheduler.Scheduler();
                sch.AfterPropertiesSet();

                svcState.ServerReady = true;

                log.Info("Server listening...");
            }
            catch (Exception e)
            {
                log.Fatal(e);
                // how to (should we) inform starter about failure during startup?
                // currently starting from service explorer causes just message
                // that service was started and then ended right after that
                throw;
            }
        }
예제 #3
0
파일: Program.cs 프로젝트: 5509850/baumax
        static void Main(string[] args)
        {
            log.Info("Starting...");
            try
            {
                ServerStateService svcState = new ServerStateService();
                RemotingServices.Marshal(svcState, "rServerStateService");
                svcState.AfterPropertiesSet();

                // Force Spring to load configuration
                IApplicationContext ctx = ContextRegistry.GetContext();

                // Define channel security
                IEnumerator channelEnum = ChannelServices.RegisteredChannels.GetEnumerator();
                while (channelEnum.MoveNext())
                {
                    BasicChannelWithSecurity channel = channelEnum.Current as BasicChannelWithSecurity;
                    if (channel != null)
                    {
                        channel.ITransportContext.IKeyStore.SetKey("/BAUMAX/SES", new KeyProvider_SelfEstablishingSymmetric());
                    }
                }

                Baumax.AppServer.Environment.ServerEnvironment.Configure();

                Scheduler.Scheduler sch = new Scheduler.Scheduler();
                sch.AfterPropertiesSet();

                svcState.ServerReady = true;

                log.Info("Server listening...");
            }
            catch (Exception e)
            {
                log.Fatal(e);
            }
            finally
            {
                System.Console.Out.WriteLine("--- Press <return> to quit ---");
                System.Console.ReadLine();
            }
        }
예제 #4
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Baumax.Localization.DefaultDiction.BuildDefaultResource();
            RemotingConfiguration.Configure("Baumax.Import.Test.exe.config");
            // Define channel security
            IEnumerator channelEnum = ChannelServices.RegisteredChannels.GetEnumerator();

            while (channelEnum.MoveNext())
            {
                BasicChannelWithSecurity channel = channelEnum.Current as BasicChannelWithSecurity;
                if (channel != null)
                {
                    channel.ITransportContext.IKeyStore.SetKey("/BAUMAX/SES",
                                                               new KeyProvider_SelfEstablishingSymmetric());
                }
            }
            SecuritySessionServices.SetCurrentSecurityContext(SecuritySessionServices.DefaultContext);
            Application.Run(new FrmMain());
        }
예제 #5
0
파일: Program.cs 프로젝트: 5509850/baumax
        private static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.ThreadException += Application_ThreadException;

            ClientEnvironment.IsRuntimeMode = true;
            UCBaseEntity.IsDesignMode       = false;
            DefaultDiction.BuildDefaultResource();

            RemotingConfiguration.Configure("Baumax.Client.exe.config", false);

            // Define channel security
            IEnumerator channelEnum = ChannelServices.RegisteredChannels.GetEnumerator();

            while (channelEnum.MoveNext())
            {
                BasicChannelWithSecurity channel = channelEnum.Current as BasicChannelWithSecurity;
                if (channel != null)
                {
                    channel.ITransportContext.IKeyStore.SetKey("/BAUMAX/SES",
                                                               new KeyProvider_SelfEstablishingSymmetric());
                }
            }

            if (!DoLogin())
            {
                return;
            }

            try
            {
                mainForm       = new MainForm();
                mainForm.Text +=
                    String.Format(" - '{0}'", ClientEnvironment.AuthorizationService.GetCurrentUser().LoginName);
                ClientEnvironment.MainForm = mainForm;

                RequestNotificationService.Attach(mainForm);

                GenuineGlobalEventProvider.GenuineChannelsGlobalEvent +=
                    GenuineGlobalEventProvider_GenuineChannelsGlobalEvent;

                ReportLocalizer.InitDevExPreviewLocalizer();
                DevExLocalizer.InitDevExLocalizer();
                DevExGridLocalizer.InitDevExGridLocalizer();

                Application.Run(mainForm);

                ClientEnvironment.DoLogout();
            }
            catch (EntityException ex)
            {
                log.Error("Unhandled", ex);
                // 2think: how to localize?
                using (FrmEntityExceptionDetails frm = new FrmEntityExceptionDetails(ex))
                {
                    frm.Text = "Unhandled exception";
                    frm.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                log.Error("Unhandled", ex);
                MessageBox.Show(ex.ToString(), "Unhandled exception");
            }
        }