Пример #1
0
        private static void LoadClassWindow()
        {
            var t = new Thread(new ThreadStart(() =>
            {
                SynchronizationContext.SetSynchronizationContext(new DispatcherSynchronizationContext(Dispatcher.CurrentDispatcher));
                ClassWindow         = new ClassWindow();
                ClassWindow.Closed += (s, ev) => ClassWindow.Dispatcher.InvokeShutdown();
                ClassWindow.Show();
                waiting = false;

                Dispatcher.Run();
            }));

            t.Name = "Class bar thread";
            t.SetApartmentState(ApartmentState.STA);
            t.Start();
            Debug.WriteLine("Class window loaded");
        }
Пример #2
0
        private static void LoadClassWindow()
        {
            var classWindowThread = new Thread(() =>
            {
                SynchronizationContext.SetSynchronizationContext(
                    new DispatcherSynchronizationContext(Dispatcher.CurrentDispatcher));
                Thread.CurrentThread.Priority = ThreadPriority.Highest;
                ClassWindow = new ClassWindow();
                if (ClassWindow.WindowSettings.Enabled)
                {
                    ClassWindow.Show();
                }
                AddDispatcher(Thread.CurrentThread.ManagedThreadId, Dispatcher.CurrentDispatcher);
                Dispatcher.Run();
                RemoveDispatcher(Thread.CurrentThread.ManagedThreadId);
            })
            {
                Name = "Class"
            };

            classWindowThread.SetApartmentState(ApartmentState.STA);
            classWindowThread.Start();
        }