Beispiel #1
0
		public static void Run(ApplicationViewModel model, bool? isMaximized)
		{
			var windowBaseView = new WindowBaseView(model);
			if (isMaximized.HasValue)
				windowBaseView.SetValue(Window.WindowStateProperty, isMaximized.Value ? WindowState.Maximized : WindowState.Minimized);
			windowBaseView.ContentRendered += (s, e) => ApplicationActivated = true;
			windowBaseView.Closing += new CancelEventHandler(win_Closing);
			windowBaseView.Closed += new EventHandler(win_Closed);
			model.Surface.Owner = null;
			model.Surface.ShowInTaskbar = true;
			model.Surface.WindowStartupLocation = WindowStartupLocation.CenterScreen;
			if (Application.Current.Dispatcher.CheckAccess())
			{
				Application.Current.MainWindow = windowBaseView;
				Application.Current.MainWindow.Show();
				Application.Current.ShutdownMode = ShutdownMode.OnMainWindowClose;
			}
			else
			{
				windowBaseView.Show();
			}
			windowBaseView.Activate();
			model.Run();
			ApplicationWindow = windowBaseView;
		}
		public static void Run(ApplicationViewModel model, bool noBorder, bool? isMaximized)
		{
			var windowBaseView = new WindowBaseView(model);
			if (noBorder)
			{
				windowBaseView.ClearValue(Window.AllowsTransparencyProperty);
				windowBaseView.ClearValue(Window.WindowStyleProperty);
				windowBaseView.ClearValue(Window.BackgroundProperty);
				windowBaseView.SetValue(Window.WindowStyleProperty, WindowStyle.None);
				windowBaseView.SetValue(Window.BackgroundProperty, new SolidColorBrush(Color.FromRgb(0x26, 0x61, 0x99)));
			}
			if (isMaximized.HasValue)
				windowBaseView.SetValue(Window.WindowStateProperty, isMaximized.Value ? WindowState.Maximized : WindowState.Minimized);
			windowBaseView.Closing += new CancelEventHandler(win_Closing);
			windowBaseView.Closed += new EventHandler(win_Closed);
			model.Surface.Owner = null;
			model.Surface.ShowInTaskbar = true;
			model.Surface.WindowStartupLocation = WindowStartupLocation.CenterScreen;
			if (Application.Current.Dispatcher.CheckAccess())
			{
				Application.Current.MainWindow = windowBaseView;
				Application.Current.MainWindow.Show();
				Application.Current.ShutdownMode = ShutdownMode.OnMainWindowClose;
			}
			else
			{
				windowBaseView.Show();
			}
			model.Run();
			ApplicationWindow = windowBaseView;
		}
Beispiel #3
0
		public static void ShowWindow(WindowBaseViewModel windowBaseViewModel)
		{
			if (!FindWindowIdentity(windowBaseViewModel))
			{
				var windowBaseView = new WindowBaseView(windowBaseViewModel);
				PrepareWindow(windowBaseViewModel);
				windowBaseView.Show();
			}
		}
Beispiel #4
0
 public static void ShowWindow(WindowBaseViewModel model)
 {
     if (!FindWindowIdentity(model))
     {
         WindowBaseView win = new WindowBaseView(model);
         PrepareWindow(model);
         win.Show();
     }
 }