Пример #1
0
 public MainWindow(MyExtMainWrapper extMainWrapper, MainWindowWrapper mainWindowWrapper, Dispatcher theSodAccessDispatcher)
 {
     this.Closing += MainWindow_Closing;
     this.Topmost = true;
     InitializeComponent();
     CustomEventsInit();
 }
Пример #2
0
        public MainWindowWrapper(MyExtMainWrapper aMyExtMainWrapper, int ID)
        {
            extMainWrapper = aMyExtMainWrapper;

            if (ID == 1 || true)
            {
                Dispatcher sodAccessDispatcher = Dispatcher.CurrentDispatcher;

                Thread thread = new Thread(() =>
                {
                    MainWindow w = new MainWindow(extMainWrapper, this, sodAccessDispatcher);
                    mainWpf = w;

                    Boolean modal = false;
                    if (modal)
                    {
                        // ShowDialog automatically starts the event queue for the new windows in the new thread.
                        // The window isn't modal though.
                        w.ShowDialog();
                    }
                    else
                    {
                        w.Show();

                        w.Closed += (sender2, e2) =>
                        {
                            w.Dispatcher.InvokeShutdown();
                        };

                        System.Windows.Threading.Dispatcher.Run();
                    }
                });

                thread.SetApartmentState(ApartmentState.STA);
                thread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US");
                thread.Start();
                Console.WriteLine("after Start");
            }
            else
            {

            }
        }