コード例 #1
0
        private void StartGinger()
        {
            Ginger.SplashWindow splash = null;
            // We start Ginger on STA thread
            mGingerThread = new Thread(() =>
            {
                SynchronizationContext.SetSynchronizationContext(new DispatcherSynchronizationContext(Dispatcher.CurrentDispatcher));

                // we need sample class - Dummy
                Ginger.GeneralLib.Dummy d = new Ginger.GeneralLib.Dummy();
                Assembly asm1             = d.GetType().Assembly;
                // Set the app resources to Ginger so image an other will be locally to Ginger
                Application.ResourceAssembly = asm1;

                app = new Ginger.App();
                Ginger.App.RunningFromUnitTest = true;
                splash = new Ginger.SplashWindow();
                splash.Show();
                //Ginger. WorkSpace.UserProfile.AutoLoadLastSolution = false;

                while (!app.IsReady && splash.IsVisible)
                {
                    Thread.Sleep(100);
                }

                GingerPOMBase.Dispatcher = app.GetMainWindowDispatcher();

                //Ginger.App.MainWindow.Closed += (sender1, e1) =>
                //    Dispatcher.CurrentDispatcher.BeginInvokeShutdown(DispatcherPriority.Background);

                MainWindowPOM = new MainWindowPOM(Ginger.App.MainWindow);

                // Makes the thread support message pumping
                System.Windows.Threading.Dispatcher.Run();
            });


            //// Configure the thread
            mGingerThread.SetApartmentState(ApartmentState.STA);
            mGingerThread.IsBackground = true;
            mGingerThread.Start();

            //max 60 seconds for Mainwindow to be ready
            int i = 0;

            while (MainWindowPOM == null && i < 600)
            {
                Thread.Sleep(100);
                i++;
            }


            while (splash.IsVisible)
            {
                Thread.Sleep(100);
            }
            // Here Ginger is live and visible
            isReady = true;
        }
コード例 #2
0
        //public static Dispatcher mDispatcher;
        public void StartGinger()
        {
            mutex.WaitOne();

            if (app != null)
            {
                return;
            }

            Ginger.SplashWindow splash = null;
            // We start Ginger on STA thread
            var t = new Thread(() =>
            {
                // we need sample class - Dummy
                Ginger.GeneralLib.Dummy d = new Ginger.GeneralLib.Dummy();
                Assembly asm1             = d.GetType().Assembly;
                // Set the app resources to Ginger so image an other will be locally to Ginger
                Application.ResourceAssembly = asm1;

                app    = new Ginger.App();
                splash = new Ginger.SplashWindow();
                splash.Show();
                //Ginger.App.UserProfile.AutoLoadLastSolution = false;

                while (!app.IsReady && splash.IsVisible)
                {
                    Thread.Sleep(100);
                }

                GingerPOMBase.mDispatcher = app.GetMainWindowDispatcher();
                MainWindowPOM             = new MainWindowPOM(Ginger.App.MainWindow);

                // Makes the thread support message pumping
                System.Windows.Threading.Dispatcher.Run();
            });


            //// Configure the thread
            t.SetApartmentState(ApartmentState.STA);
            t.Start();

            //max 60 seconds for Mainwindow to be ready
            int i = 0;

            while (MainWindowPOM == null && i < 600)
            {
                Thread.Sleep(100);
                i++;
            }


            while (splash.IsVisible)
            {
                Thread.Sleep(100);
            }
            // Here Ginger WPF is live and visible
        }
コード例 #3
0
        private void StartGinger()
        {
            // We start Ginger on STA thread
            mGingerThread = new Thread(() =>
            {
                SynchronizationContext.SetSynchronizationContext(new DispatcherSynchronizationContext(Dispatcher.CurrentDispatcher));

                // we need sample class - Dummy
                Ginger.GeneralLib.Dummy d = new Ginger.GeneralLib.Dummy();
                Assembly asm1             = d.GetType().Assembly;
                // Set the app resources to Ginger so image an other will be locally to Ginger
                Application.ResourceAssembly = asm1;

                app = new Ginger.App();
                WorkSpace.Init(new WorkSpaceEventHandler());
                WorkSpace.Instance.RunningFromUnitTest = true;
                WorkSpace.Instance.InitWorkspace(new GingerWorkSpaceReporter(), new RepositoryItemFactory());


                app.HideConsoleWindow();
                app.StartGingerUI();

                GingerPOMBase.Dispatcher = app.GetMainWindowDispatcher();

                //Ginger.App.MainWindow.Closed += (sender1, e1) =>
                //    Dispatcher.CurrentDispatcher.BeginInvokeShutdown(DispatcherPriority.Background);

                MainWindowPOM = new MainWindowPOM(Ginger.App.MainWindow);

                // Makes the thread support message pumping
                System.Windows.Threading.Dispatcher.Run();
            });


            //// Configure the thread
            mGingerThread.SetApartmentState(ApartmentState.STA);
            mGingerThread.IsBackground = true;
            mGingerThread.Start();

            //max 60 seconds for Main window to be ready
            int i = 0;

            while (MainWindowPOM == null && i < 600)
            {
                Thread.Sleep(100);
                i++;
            }


            // Here Ginger is live and visible
            isReady = true;
        }