private void ActivateWindow(Window window) { if (ApplicationShell != null) { window.Owner = ApplicationShell; window.WindowStartupLocation = WindowStartupLocation.CenterOwner; } window.Show(); window.Activate(); }
/// <summary> /// Shows the modal. /// </summary> /// <param name="owner">The owner.</param> public void ShowModal(Window owner, IUserInputManager userInputManager = null) { _userInputManager = userInputManager; WindowStyle = WindowStyle.None; ResizeMode = ResizeMode.NoResize; ShowInTaskbar = false; WindowStartupLocation = WindowStartupLocation.Manual; AllowsTransparency = true; Width = owner.Width; Height = owner.Height; Top = owner.Top; Left = owner.Left; WindowState = owner.WindowState; Owner = owner; EventHandler closedHanlder = null; closedHanlder = (sender, e) => { owner.Activate(); Closed -= closedHanlder; }; Closed += closedHanlder; Show(); }
//-------------------------------------------------------------------------------------------------- void _Closing(object sender, System.ComponentModel.CancelEventArgs e) { using (new WaitCursor()) { while (_MainWindow == null) { Thread.Sleep(100); } lock (this) { Current = null; _MainWindow.ContentRendered -= _MainWindow_OnContentRendered; _MainWindow.Closed -= _MainWindow_OnClosed; } _MainWindow.Dispatcher.Invoke(() => { IntPtr handle = new System.Windows.Interop.WindowInteropHelper(_MainWindow).Handle; Win32Api.EnableWindow(new HandleRef(_MainWindow, handle), true); _MainWindow.Activate(); }); } }
public void Initialize(Window window, bool activate = true) { if (window.Content == null) window.Content = RootFrame; if (activate) window.Activate(); }
public void BringWindowToForeground() { window.Activate(); if (window.WindowState == WindowState.Minimized) { window.WindowState = WindowState.Normal; } }
static void TryActivateMainWindow(Window mainWindow) { try { mainWindow.Show(); mainWindow.Activate(); } catch (InvalidOperationException e) { MainLog.Logger.FormattedDebugException(e); } }
public void ExampleTest() { var window = new Window() {Width = 100, Height = 100}; window.Show(); window.Activate(); window.Dispatcher.InvokeShutdown(); window.Close(); }
public static void BringToFrontWindow(Window w) { ExecuteUIHelper(w, () => { if (w.WindowState == WindowState.Minimized) w.WindowState = WindowState.Normal; w.Show(); w.Activate(); }); }
public static void ActivateWindow(Window window) { var interopHelper = new WindowInteropHelper(window); var currentForegroundWindow = GetForegroundWindow(); var thisWindowThreadId = GetWindowThreadProcessId(interopHelper.Handle, IntPtr.Zero); var currentForegroundWindowThreadId = GetWindowThreadProcessId(currentForegroundWindow, IntPtr.Zero); AttachThreadInput(currentForegroundWindowThreadId, thisWindowThreadId, true); SetWindowPos(interopHelper.Handle, new IntPtr(0), 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW); AttachThreadInput(currentForegroundWindowThreadId, thisWindowThreadId, false); window.Show(); window.Activate(); }
public static void FocusWindow(System.Windows.Window win) { if (win.WindowState == WindowState.Minimized) { win.WindowState = WindowState.Normal; } win.Activate(); win.Topmost = true; // important win.Topmost = false; // important win.Focus(); // important }
/// <summary> /// Setup and show a window. /// </summary> /// <param name="window">window to set up</param> /// <param name="viewModel">view model to assign to the view model</param> /// <param name="closedViewMethod">request from the view model to close the view</param> /// <param name="closedMethod">method to run when the window closes</param> public void SetupWindow( System.Windows.Window window, NynaeveLib.ViewModel.ViewModelBase viewModel, EventHandler closeViewMethod, EventHandler closedMethod) { window.DataContext = viewModel; viewModel.ClosingRequest += closeViewMethod; window.Closed += closedMethod; window.Show(); window.Activate(); }
public static void BringToForeground(Window mainWindow) { if (mainWindow.WindowState == WindowState.Minimized || mainWindow.Visibility == Visibility.Hidden) { mainWindow.Show(); mainWindow.WindowState = WindowState.Normal; } // According to some sources these steps gurantee that an app will be brought to foreground. mainWindow.Activate(); mainWindow.Topmost = true; mainWindow.Topmost = false; mainWindow.Focus(); mainWindow.ShowInTaskbar = true; }
public override void ActivateForm(Window form, Window window, IntPtr hwnd) { var fHandle = (PresentationSource.FromVisual(form) as HwndSource).Handle; var wHandle = (PresentationSource.FromVisual(window) as HwndSource).Handle; if (window == null || wHandle != fHandle) { // bring to top form.Topmost = true; form.Topmost = false; // set as active form in task bar form.Activate(); // stop flashing...happens occassionally when switching quickly when activate manuver is fails Shell32.FlashWindow(fHandle, 0); } }
private void ActivateWindow(Window window) { if (!window.IsVisible) { window.Show(); } if (window.WindowState == WindowState.Minimized) { window.WindowState = WindowState.Normal; } window.Activate(); window.Topmost = true; window.Topmost = false; window.Focus(); }
/// <summary> /// 启动当前窗体 /// </summary> /// <param name="args"></param> /// <returns></returns> public bool SignalExternalCommandLineArgs(IList <string> args) { bool flag; System.Windows.Window mainWindow = base.MainWindow; if (mainWindow != null) { mainWindow.WindowState = WindowState.Normal; mainWindow.Activate(); flag = true; } else { flag = true; } return(flag); }
/// <summary> /// Shows the modal. /// </summary> /// <param name="owner">The owner.</param> public void ShowModal(Window owner) { WindowStyle = WindowStyle.None; ResizeMode = ResizeMode.NoResize; ShowInTaskbar = false; WindowStartupLocation = WindowStartupLocation.Manual; AllowsTransparency = true; Width = owner.Width; Height = owner.Height; Top = owner.Top; Left = owner.Left; WindowState = owner.WindowState; Owner = owner; ShowDialog(); owner.Activate(); }
static window GetWindow(OpenShell.Screens.Screen screen) { var window = new window { Topmost = true, AllowsTransparency = true, Background = new SolidColorBrush(Color.FromArgb(1, 1, 1, 1)), WindowStyle = WindowStyle.None, Left = screen.Bounds.Left, Top = screen.Bounds.Top, Width = screen.Bounds.Width, Height = screen.Bounds.Height, ShowInTaskbar = false, ShowActivated = true, }; window.Activate(); return(window); }
/// <summary> /// ウィンドウを表示します。 /// </summary> /// <param name="windowName">表示するウィンドウの名前を指定します。</param> /// <returns>表示するウィンドウを返します。</returns> private System.Windows.Window ShowWindowCore(string windowName) { if (windowName == null) { return(null); } System.Windows.Window vw = null; KeyValuePair <Type, Type> pair; if (_windowMap.TryGetValue(windowName, out pair)) { var vwType = pair.Key; var vmType = pair.Value; vw = views.FirstOrDefault(view => view.GetType() == vwType); if (vw == null) { vw = CrateWindowInstance(vwType, vmType); if (vw != null) { views.Add(vw); vw.Show(); } } else { if (vw.WindowState == WindowState.Minimized) { vw.WindowState = WindowState.Normal; } vw.Activate(); } } return(vw); }
/// <summary> /// Activate a window from anywhere by attaching to the foreground window /// </summary> public static void GlobalActivate(this Window w) { //Get the process ID for this window's thread var interopHelper = new WindowInteropHelper(w); var thisWindowThreadId = GetWindowThreadProcessId(interopHelper.Handle, IntPtr.Zero); //Get the process ID for the foreground window's thread var currentForegroundWindow = GetForegroundWindow(); var currentForegroundWindowThreadId = GetWindowThreadProcessId(currentForegroundWindow, IntPtr.Zero); //Attach this window's thread to the current window's thread AttachThreadInput(currentForegroundWindowThreadId, thisWindowThreadId, true); //Set the window position SetWindowPos(interopHelper.Handle, new IntPtr(0), 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW); //Detach this window's thread from the current window's thread AttachThreadInput(currentForegroundWindowThreadId, thisWindowThreadId, false); //Show and activate the window if (w.WindowState == WindowState.Minimized) { w.WindowState = WindowState.Normal; } w.Show(); w.Activate(); }
/// <summary> /// Activates the window and makes sure the window is in the foreground. /// </summary> /// <param name="window">The window. Can be <see langword="null"/>.</param> /// <remarks> /// The method <see cref="Window.Activate"/> of the <see cref="Window"/> class should /// activate a window and bring it to the foreground. However, this does not always work. /// Sometimes the application icon in the task bar flashes, but the windows stays inactive. /// This method uses a few tricks to make sure that the window lands in the foreground. /// </remarks> public static void ActivateWindow(Window window) { if (window == null) return; // Bring application to foreground: // Calling Window.Activate() immediately or deferred using Dispatcher.BeginInvoke // does not work. The icon in the task bar flashes, but the windows stays inactive. //_shell.Window.Activate(); //_shell.Window.Dispatcher.BeginInvoke(new Action(() => _shell.Window.Activate())); // Following calls should make sure that the window lands in the foreground: // (from http://stackoverflow.com/questions/257587/bring-a-window-to-the-front-in-wpf) if (!window.IsVisible) window.Show(); if (window.WindowState == WindowState.Minimized) window.WindowState = WindowState.Normal; window.Activate(); window.Topmost = true; window.Topmost = false; window.Focus(); }
public override void ActivateForm(Window form, Window window, IntPtr hwnd) { var fHandle = (PresentationSource.FromVisual(form) as HwndSource).Handle; var wHandle = window == null ? IntPtr.Zero : (PresentationSource.FromVisual(window) as HwndSource).Handle; if (window == null || wHandle != fHandle) { IntPtr Dummy = IntPtr.Zero; IntPtr hWnd = fHandle; if (User32.IsIconic(hWnd)) { User32.ShowWindowAsync(hWnd, SW_RESTORE); } else { //User32.ShowWindowAsync(hWnd, SW_SHOW); form.ShowActivated = true; form.Show(); } User32.SetForegroundWindow(hWnd); form.Activate(); form.Topmost = true; form.Topmost = false; // Code from Karl E. Peterson, www.mvps.org/vb/sample.htm // Converted to Delphi by Ray Lischner // Published in The Delphi Magazine 55, page 16 // Converted to C# by Kevin Gale IntPtr foregroundWindow = User32.GetForegroundWindow(); if (foregroundWindow != hWnd) { uint foregroundThreadId = User32.GetWindowThreadProcessId(foregroundWindow, Dummy); uint thisThreadId = User32.GetWindowThreadProcessId(hWnd, Dummy); if (User32.AttachThreadInput(thisThreadId, foregroundThreadId, true)) { form.Activate(); form.Topmost = true; form.Topmost = false; User32.BringWindowToTop(hWnd); // IE 5.5 related hack User32.SetForegroundWindow(hWnd); User32.AttachThreadInput(thisThreadId, foregroundThreadId, false); } } if (User32.GetForegroundWindow() != hWnd) { // Code by Daniel P. Stasinski // Converted to C# by Kevin Gale IntPtr Timeout = IntPtr.Zero; User32.SystemParametersInfo(SPI_GETFOREGROUNDLOCKTIMEOUT, 0, Timeout, 0); User32.SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, Dummy, SPIF_SENDCHANGE); User32.BringWindowToTop(hWnd); // IE 5.5 related hack User32.SetForegroundWindow(hWnd); form.Activate(); form.Topmost = true; form.Topmost = false; User32.SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, Timeout, SPIF_SENDCHANGE); } Shell32.FlashWindow(fHandle, 0); } }
private void OpenWindow(Window window) { window.WindowState = WindowState.Normal; window.Show(); window.Activate(); }
public static DXSplashScreenService CreateDefaultSplashScreenAndShow(Window window, FrameworkElement owner = null, SplashScreenOwnerSearchMode ownerSearchMode = SplashScreenOwnerSearchMode.Full , bool activateWindow = true, FrameworkElement windowContent = null, SplashScreenClosingMode? closingMode = null) { DXSplashScreenService service = CreateDefaultService(); service.SplashScreenOwner = owner; if(closingMode.HasValue) service.SplashScreenClosingMode = closingMode.Value; service.OwnerSearchMode = ownerSearchMode; if(windowContent == null) Interaction.GetBehaviors(window).Add(service); else { window.Do(x => x.Content = windowContent); Interaction.GetBehaviors(windowContent).Add(service); } if(window != null) { window.Show(); if(activateWindow && !window.IsActive) window.Activate(); DispatcherHelper.UpdateLayoutAndDoEvents(window); } service.ShowSplashScreen(); SplashScreenTestUserControl.DoEvents(); return service; }
void IWindowFrameBackend.Present() { window.Activate(); }
public static void WinCondition() { Window win = new Window(); win.Title = "You win!"; win.Activate(); }
private static void ActivateWindow(Window window) { window.Dispatcher.Invoke( new SendOrPostCallback( delegate(object ignored) { window.Activate(); }), String.Empty); }
// ReSharper restore UnusedParameter.Local /// <summary> /// Locates the window passed as if it is a Progman, the Start Menu. /// First, by screenPoint passed calculates active screen. /// By it's bounds determines the location of TaskBar. /// Finally, calculates the position of target window. /// Shows window except if it is a Placement rectangle. /// Focuses window if it is a ButtonStack. /// </summary> /// <param name="w">Window to locate</param> /// <param name="screenPoint">Unmanaged struct containing absolute screen coordinates, in px.</param> /// <param name="ignoreTaskbarPosition">Flag instructing method to ignore the location of task bar /// locating w simply in the corner closest to the screenPoint. E.g. to show BtnStch by Alt+Z.</param> private static void GetSetWndPosition(Window w, API.POINT screenPoint, bool ignoreTaskbarPosition) { var resPoint = new Point(); var screen = Screen.FromPoint(new System.Drawing.Point(screenPoint.X, screenPoint.Y)); //We show stack in the corner closest to the mouse bool isHideTaskBarOptionOn = (screen.WorkingArea.Width == screen.Bounds.Width && screen.WorkingArea.Height == screen.Bounds.Height) || ignoreTaskbarPosition; //taskbar is vertical @ left or horizontal if ((isHideTaskBarOptionOn && screenPoint.X <= screen.WorkingArea.X + screen.WorkingArea.Width/2) || screen.WorkingArea.X > screen.Bounds.X || (screen.WorkingArea.Width == screen.Bounds.Width & !isHideTaskBarOptionOn)) resPoint.X = screen.WorkingArea.X; else //vertical @ right resPoint.X = (screen.WorkingArea.Width + screen.WorkingArea.X - w.Width*SystemScale)/SystemScale; //taskbar is horizontal @ top or vertical if ((isHideTaskBarOptionOn && screenPoint.Y <= screen.WorkingArea.Y + screen.WorkingArea.Height/2) || screen.WorkingArea.Y > screen.Bounds.Y || (screen.WorkingArea.Height == screen.Bounds.Height & !isHideTaskBarOptionOn)) resPoint.Y = screen.WorkingArea.Y; else //horizontal @ bottom resPoint.Y = (screen.WorkingArea.Height + screen.WorkingArea.Y - w.Height*SystemScale)/SystemScale; w.Left = resPoint.X; w.Top = resPoint.Y; // ReSharper disable PossibleUnintendedReferenceComparison if(w != PlacementWnd) w.Activate(); // ReSharper restore PossibleUnintendedReferenceComparison var b = w as BtnStck; if (b != null) b.Focus();//Focus() is __new on ButtonStack, must explicitly type }
internal static void LoseCondition() { Window lose = new Window(); lose.Title = "You lose!"; lose.Activate(); }
private void BringToFront(Window window) { if (window.WindowState == WindowState.Minimized) window.WindowState = WindowState.Normal; window.Activate(); window.Topmost = true; window.Topmost = false; window.Focus(); }
private void ShowWindow(Window win) { // ウィンドウ表示&最前面に持ってくる if (win.WindowState == System.Windows.WindowState.Minimized) win.WindowState = System.Windows.WindowState.Normal; win.Show(); win.Activate(); // タスクバーでの表示をする win.ShowInTaskbar = true; }
void OpenSettings(object sender, System.EventArgs e) { var bitmap = new BitmapImage(); bitmap.BeginInit(); bitmap.UriSource = new Uri("pack://application:,,,/GitHistory;component/GitHub.ico"); bitmap.EndInit(); var settingsControlViewModel = new SettingsControlViewModel(); var window = new Window { Content = new SettingsControl {DataContext = settingsControlViewModel}, Title = "Settings", Width = 420, Height = 160, ResizeMode = ResizeMode.NoResize, Icon = bitmap }; window.Show(); window.Activate(); settingsControlViewModel.Saved += (o, args) => SettingsSaved(window); }
void ShowWindow(Window window) { try { if (window.Visibility != Visibility.Visible) window.Show(); if (window.WindowState == WindowState.Minimized) window.WindowState = WindowState.Normal; window.Activate(); } catch { } }
private void Button_Click(object sender, RoutedEventArgs e) { StackPanel pn2 = new StackPanel(); Grid gr2 = new Grid(); Label lbl = new Label(); TextWriter writer = new LabelTextWriter(lbl); Console.SetOut(writer); lbl.Content = "Load is very high! Please wait..."; Console.Write("dasda"); lbl.Margin = new Thickness(200, System.Windows.SystemParameters.PrimaryScreenHeight / 2, 0, 0); lbl.FontSize = 35; lbl.FontFamily = new FontFamily("Consolas"); lbl.Foreground = Brushes.White; gr2.Children.Add(lbl); pn2.Children.Add(gr2); Window window2 = new Window(); LabelTextReader textReader = new LabelTextReader(lbl, window2); textReader.StartReadKey(); textReader.OutputReady += output1 => { //window2.Close(); output = output1; Console.Write(""); //tb.Text = textReader.StandardOutput; }; Console.Write(""); window2.Topmost = true; window2.WindowState = WindowState.Maximized; window2.WindowStyle = WindowStyle.None; window2.AllowsTransparency = true; window2.Background = Brushes.Gray; window2.Opacity = 0.8; window2.IsHitTestVisible = true; window2.Content = pn2; window2.ShowInTaskbar = false; window2.Show(); window2.Activate(); }
/// <summary> /// Metodo que crea el notifyIcon, se pasa el form sobre el que se va aplicar. /// </summary> /// <param name="form">Formulario que se aplica al NotifyIcon</param> /// <returns>torna un objecto de tipo NotifyIcon</returns> /// <history> /// [michan] 25/04/2016 Created /// </history> public static NotifyIcon Notify(System.Windows.Application app = null, System.Windows.Window form = null, string title = null) { /// Objeto del tipo NotifyIcon System.Windows.Forms.NotifyIcon notifyIcon = new System.Windows.Forms.NotifyIcon(); //_frm = form; ///icono que muestra la nube de notificación. será tipo info, pero existen warning, error, etc.. notifyIcon.BalloonTipIcon = System.Windows.Forms.ToolTipIcon.Info; string strTitle = ""; ///la ruta del icono que se va a mostrar cuando la app esté minimizada. if (form != null) { if (form.Icon != null) { Uri iconUri = new Uri(form.Icon.ToString(), UriKind.RelativeOrAbsolute); System.IO.Stream iconStream = System.Windows.Application.GetResourceStream(new Uri(form.Icon.ToString())).Stream; notifyIcon.Icon = new System.Drawing.Icon(iconStream); } strTitle = form.Title.ToString(); } // AppContext.BaseDirectory else if (app != null) { notifyIcon.Icon = System.Drawing.Icon.ExtractAssociatedIcon(System.Windows.Forms.Application.ExecutablePath); } if (title != null) { strTitle = title; } //notifyIcon.Icon = new System.Drawing.Icon(iconStream);//@"M:\PalaceResorts\Client4.6\IntelligenceMarketing\IM.Base\Images\IM.ico"); /// Mensaje que se muestra al minimizar al formulario notifyIcon.BalloonTipTitle = "Information"; notifyIcon.Text = (!String.IsNullOrEmpty(strTitle) && !String.IsNullOrWhiteSpace(strTitle)) ? strTitle : "The application"; notifyIcon.BalloonTipText = "Running " + strTitle; notifyIcon.Visible = true; /// Evento clic para mostrar la ventana cuando se encuentre minimizada. notifyIcon.Click += new EventHandler( (s, e) => { if (notifyIcon != null) { /// cuando se pulse el boton mostrará informacion, cambiaremos los textos para que muestre que la app esta trabajando... notifyIcon.BalloonTipIcon = ToolTipIcon.Warning; notifyIcon.BalloonTipText = strTitle + " is working..."; notifyIcon.BalloonTipTitle = "Wait..."; notifyIcon.ShowBalloonTip(400); notifyIcon.BalloonTipIcon = ToolTipIcon.Info; notifyIcon.BalloonTipText = strTitle + " Running..."; notifyIcon.BalloonTipTitle = "Information"; } } ); notifyIcon.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler( (s, e) => { if (notifyIcon != null) { if (form != null) { form.Show(); form.WindowState = WindowState.Normal; form.Activate(); } else if (app != null) { app.MainWindow.Show(); app.MainWindow.WindowState = WindowState.Normal; app.MainWindow.Activate(); } notifyIcon.Visible = true; notifyIcon.ContextMenu.MenuItems[0].Visible = false; notifyIcon.ContextMenu.MenuItems[1].Visible = true; } } ); // agrgegamos el menu en el notyficon notifyIcon.ContextMenu = new System.Windows.Forms.ContextMenu( /// Menu contextual que sera visible en el icono new System.Windows.Forms.MenuItem[] { new System.Windows.Forms.MenuItem( "Show",// opcion de abrir para cuando la ventana este minimizada (s, e) => { if (form != null) { //Se agrega al menu la opcion para mostrar el formulario form.Show(); form.WindowState = WindowState.Normal; form.Activate(); } else if (app != null) { app.MainWindow.Show(); app.MainWindow.WindowState = WindowState.Normal; app.MainWindow.Activate(); } notifyIcon.Visible = true; notifyIcon.ContextMenu.MenuItems[0].Visible = false; notifyIcon.ContextMenu.MenuItems[1].Visible = true; } ), new System.Windows.Forms.MenuItem( "Hide",// opcion para mostrar la ventana cuando se encuentre maximizada (s, e) => { if (form != null) { // Se agrega en el menu la opcion para ocultar el form form.Hide(); form.WindowState = WindowState.Minimized; } else if (app != null) { app.MainWindow.Hide(); app.MainWindow.WindowState = WindowState.Minimized; } notifyIcon.Visible = true; notifyIcon.ShowBalloonTip(400); notifyIcon.ContextMenu.MenuItems[0].Visible = true; notifyIcon.ContextMenu.MenuItems[1].Visible = false; } ), new System.Windows.Forms.MenuItem("-"), new System.Windows.Forms.MenuItem("Close", (s, e) => { if (form != null) { form.Close(); } else if (app != null) { app.Shutdown(); } } ) } ); notifyIcon.ContextMenu.MenuItems[0].Visible = false; notifyIcon.ContextMenu.MenuItems[1].Visible = true; return(notifyIcon); }
public void SplashScreenOwnerPriority_Test04() { IsolatedDomainTestHelper.RunTest(() => { Application app = new Application(); var window = new Window(); app.MainWindow = window; app.Startup += (o, e) => { RealWindow = new Window(); window.Show(); DispatcherHelper.UpdateLayoutAndDoEvents(window); RealWindow.Show(); if(!RealWindow.IsActive) RealWindow.Activate(); DispatcherHelper.UpdateLayoutAndDoEvents(RealWindow); var fakeOwner = new Border(); DXSplashScreenService service = SplashScreenTestsHelper.CreateDefaultSplashScreenAndShow(null, null, SplashScreenOwnerSearchMode.IgnoreAssociatedObject, true, fakeOwner); var info = DXSplashScreen.SplashContainer.ActiveInfo; Assert.IsNotNull(info.Owner.WindowObject); Assert.AreEqual(SplashScreenHelper.GetApplicationActiveWindow(true), info.Owner.WindowObject); Assert.IsTrue(info.Owner.IsInitialized); Assert.AreEqual(RealWindow, info.Owner.Window); SplashScreenTestsHelper.CloseDXSplashScreen(); RealWindow.Close(); RealWindow.Content = null; DispatcherHelper.UpdateLayoutAndDoEvents(RealWindow); RealWindow = null; window.Close(); DispatcherHelper.UpdateLayoutAndDoEvents(window); }; app.Run(); }); }
/// <summary> /// Brings a window to the front /// </summary> /// <param name="w">Window to bring to front</param> public static void BringToFront(Window w) { if (w.WindowState == WindowState.Minimized) w.WindowState = WindowState.Normal; w.Activate(); }
private void ShowWindow(Window win) { if (win.WindowState == System.Windows.WindowState.Minimized) win.WindowState = System.Windows.WindowState.Normal; win.Show(); win.Activate(); win.ShowInTaskbar = true; }