예제 #1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var eventBroker = new EventBroker();

            var form = new FormMain();
            var controller1 = new Controller();
            controller1.EventBroker = eventBroker;
            controller1.ChatView = form.ChatView1;

            var controller2 = new Controller();
            controller2.EventBroker = eventBroker;
            controller2.ChatView = form.ChatView2;

            var service = new Service();
            service.EventBroker = eventBroker;

            eventBroker.UISynchronizationContext = WindowsFormsSynchronizationContext.Current;
            eventBroker.Subscribers = new object[] { controller1, controller2, service };
            eventBroker.Start();

            Application.Run(form);

            eventBroker.Stop();
        }
예제 #2
0
        public void AutoOpen()
        {
            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");

            System.Windows.Forms.Application.EnableVisualStyles();
            ChiffrageExcelAddin.eventBroker = new EventBroker();
            ChiffrageExcelAddin.eventBroker.Subscribe(this);

            this.view = new ImportCatalogWizardView(ChiffrageExcelAddin.EventBroker);

            AppDomain.CurrentDomain.UnhandledException += (sender, ex) => { logger.Error("UnhandledException", (Exception)ex.ExceptionObject); };

            logger.InfoFormat("Loaded");
        }