/// <summary> /// Restores current window to its original dimensions /// </summary> /// <param name="windowHandle">NativeWindowHandle to window</param> /// <exception cref="ProdOperationException">Examine inner exception</exception> public static void WindowRestore(IntPtr windowHandle) { try { WindowPatternHelper.SetVisualState(AutomationElement.FromHandle(windowHandle), WindowVisualState.Normal); } catch (InvalidOperationException err) { throw new ProdOperationException(err.Message, err); } catch (ElementNotAvailableException err) { throw new ProdOperationException(err.Message, err); } catch (ArgumentException err) { throw new ProdOperationException(err.Message, err); } }
/// <summary> /// Minimizes the current window /// </summary> /// <param name="windowHandle">NativeWindowHandle to window</param> /// <exception cref="ProdOperationException">Examine inner exception</exception> public static void WindowMinimize(IntPtr windowHandle) { try { WindowPatternHelper.SetVisualState(AutomationElement.FromHandle(windowHandle), WindowVisualState.Minimized); } catch (InvalidOperationException) { ProdWindowNative.MinimizeWindowNative(windowHandle); } catch (ElementNotAvailableException err) { throw new ProdOperationException(err.Message, err); } catch (ArgumentException err) { throw new ProdOperationException(err.Message, err); } catch (Win32Exception werr) { throw new ProdOperationException(werr.Message, werr); } }
//private static void NativeRestoreWindow(ProdWindow baseControl) //{ // ProdWindowNative.ShowWindowNative(baseControl.NativeHandle); //} private static void UiaRestoreWindow(ProdWindow baseControl) { WindowPatternHelper.SetVisualState(baseControl.UIAElement, WindowVisualState.Normal); LogController.ReceiveLogMessage(new LogMessage("restored")); }
//private static void NativeMaximizeWindow(ProdWindow baseControl) //{ // ProdWindowNative.MaximizeWindowNative(baseControl.NativeHandle); //} private static void UiaMaximizeWindow(ProdWindow baseControl) { WindowPatternHelper.SetVisualState(baseControl.UIAElement, WindowVisualState.Maximized); LogController.ReceiveLogMessage(new LogMessage("maximized")); }