コード例 #1
0
        private void ShowMessageAsync()
        {
            this.messageThread = new Thread(new ThreadStart(() =>
            {
                MessageBoxTestHelper helper = new MessageBoxTestHelper();
                helper.ShowMessageBox();
                Dispatcher.Run();
            }));

            this.messageThread.SetApartmentState(ApartmentState.STA);
            this.messageThread.Start();
        }
コード例 #2
0
        private Thread CreateMessageBoxOnSeparateThread()
        {
            Thread t = new Thread(new ThreadStart(() =>
            {
                this.messageBoxTestHelperInstance = new MessageBoxTestHelper();
                this.messageBoxTestHelperInstance.ShowMessageBox();

                Dispatcher.Run();
            }));

            t.SetApartmentState(ApartmentState.STA);

            return(t);
        }