private void BuildWindow(WindowDescriptor descriptor) {
      Thread thread = new Thread(() => {
        SynchronizationContext.SetSynchronizationContext(new DispatcherSynchronizationContext(Dispatcher.CurrentDispatcher));
        WindowDevice window = new WindowDevice(descriptor);
        window.Closing += (sender2, e2) => { window.Hide(); e2.Cancel = true; };

        Log("Building : " + descriptor.Name);
        lock (Windows) { Windows.Add(descriptor.Name, window); }
        System.Windows.Threading.Dispatcher.Run();
      });

      thread.Name = descriptor.Name;
      thread.SetApartmentState(ApartmentState.STA);
      thread.IsBackground = true;
      thread.Start();
    }
Exemple #2
0
        private void BuildWindow(WindowDescriptor descriptor)
        {
            Thread thread = new Thread(() => {
                SynchronizationContext.SetSynchronizationContext(new DispatcherSynchronizationContext(Dispatcher.CurrentDispatcher));
                WindowDevice window = new WindowDevice(descriptor);
                window.Closing     += (sender2, e2) => { window.Hide(); e2.Cancel = true; };

                Log("Building : " + descriptor.Name);
                lock (Windows) { Windows.Add(descriptor.Name, window); }
                System.Windows.Threading.Dispatcher.Run();
            });

            thread.Name = descriptor.Name;
            thread.SetApartmentState(ApartmentState.STA);
            thread.IsBackground = true;
            thread.Start();
        }