Exemple #1
0
        public async Task StartAsync()
        {
            await Task.Yield();                                   //test that the synchronization context is properly set up

            SplashScreenWpf splashScreen = new SplashScreenWpf(); //not disposable, but I'm keeping the same structure
            {
                splashScreen.Closed += m_mainForm_FormClosed;     //if user closes splash screen, let's quit
                splashScreen.Show();

                await m_mainForm.InitializeAsync();

                //http://blogs.msdn.com/b/wpfsdk/archive/2007/04/03/centering-wpf-windows-with-wpf-and-non-wpf-owner-windows.aspx
                WindowInteropHelper splashScreenHelper = new WindowInteropHelper(splashScreen);
                splashScreenHelper.Owner = m_mainForm.Handle;

                m_mainForm.Show();
                splashScreen.Closed -= m_mainForm_FormClosed;
                splashScreen.Close();
            }


            //This lets you test
            Button b = new Button
            {
                Text     = "Show WPF window",
                AutoSize = true,
            };

            m_mainForm.Controls.Add(b);
            b.Click += (sender, e) =>
            {
                new SplashScreenWpf().Show();
            };
        }
            public async Task StartAsync()
            {
                SplashScreenWpf splashScreen = new SplashScreenWpf();         //not disposable

                splashScreen.Closed += m_mainForm_FormClosed;                 //if user closes splash screen, let's quit
                splashScreen.Show();

                await m_mainForm.InitializeAsync();

                //http://blogs.msdn.com/b/wpfsdk/archive/2007/04/03/centering-wpf-windows-with-wpf-and-non-wpf-owner-windows.aspx
                WindowInteropHelper splashScreenHelper = new WindowInteropHelper(splashScreen);

                splashScreenHelper.Owner = m_mainForm.Handle;

                m_mainForm.Show();
                splashScreen.Closed -= m_mainForm_FormClosed;
                splashScreen.Close();
            }
        public async Task StartAsync()
        {
            await Task.Yield();                                   //test that the synchronization context is properly set up

            SplashScreenWpf splashScreen = new SplashScreenWpf(); //not disposable, but I'm keeping the same structure
            {
                splashScreen.Closed += m_mainForm_FormClosed;     //if user closes splash screen, let's quit
                splashScreen.Show();

                await m_mainForm.InitializeAsync();

                //http://blogs.msdn.com/b/wpfsdk/archive/2007/04/03/centering-wpf-windows-with-wpf-and-non-wpf-owner-windows.aspx
                WindowInteropHelper splashScreenHelper = new WindowInteropHelper(splashScreen);
                splashScreenHelper.Owner = m_mainForm.Handle;

                m_mainForm.Show();
                splashScreen.Closed -= m_mainForm_FormClosed;
                splashScreen.Close();
            }
        }
		public async Task StartAsync()
		{
			await Task.Yield(); //test that the synchronization context is properly set up

			SplashScreenWpf splashScreen = new SplashScreenWpf(); //not disposable, but I'm keeping the same structure
			{
				splashScreen.Closed += m_mainForm_FormClosed; //if user closes splash screen, let's quit
				splashScreen.Show();

				await m_mainForm.InitializeAsync();

				//http://blogs.msdn.com/b/wpfsdk/archive/2007/04/03/centering-wpf-windows-with-wpf-and-non-wpf-owner-windows.aspx
				WindowInteropHelper splashScreenHelper = new WindowInteropHelper(splashScreen);
				splashScreenHelper.Owner = m_mainForm.Handle;

				m_mainForm.Show();
				splashScreen.Closed -= m_mainForm_FormClosed;
				splashScreen.Close();
			}
		}
Exemple #5
0
			public async Task StartAsync()
			{
				SplashScreenWpf splashScreen = new SplashScreenWpf(); //not disposable
				splashScreen.Closed += m_mainForm_FormClosed; //if user closes splash screen, let's quit
				splashScreen.Show();

				await m_mainForm.InitializeAsync();

				//http://blogs.msdn.com/b/wpfsdk/archive/2007/04/03/centering-wpf-windows-with-wpf-and-non-wpf-owner-windows.aspx
				WindowInteropHelper splashScreenHelper = new WindowInteropHelper(splashScreen);
				splashScreenHelper.Owner = m_mainForm.Handle;

				m_mainForm.Show();
				splashScreen.Closed -= m_mainForm_FormClosed;
				splashScreen.Close();
			}
		public async Task StartAsync()
		{
			await Task.Yield(); //test that the synchronization context is properly set up

			SplashScreenWpf splashScreen = new SplashScreenWpf();  //not disposable, but I'm keeping the same structure
			{
				splashScreen.Closed += m_mainForm_FormClosed; //if user closes splash screen, let's quit
				splashScreen.Show();

				await m_mainForm.InitializeAsync();

				//http://blogs.msdn.com/b/wpfsdk/archive/2007/04/03/centering-wpf-windows-with-wpf-and-non-wpf-owner-windows.aspx
				WindowInteropHelper splashScreenHelper = new WindowInteropHelper(splashScreen);
				splashScreenHelper.Owner = m_mainForm.Handle;

				m_mainForm.Show();
				splashScreen.Closed -= m_mainForm_FormClosed;
				splashScreen.Close();
			}


			//This lets you test
			Button b = new Button
			{
				Text = "Show WPF window", 
				AutoSize = true,
			};
			m_mainForm.Controls.Add(b);
			b.Click += (sender, e) =>
			{
				new SplashScreenWpf().Show();
			};
		}