示例#1
0
        private static bool UiaWaitForInputIdle(ProdWindow baseControl, int delay)
        {
            bool retVal = WindowPatternHelper.WaitForInputIdle(baseControl.UIAElement, delay);

            LogController.ReceiveLogMessage(new LogMessage(retVal.ToString()));
            return(retVal);
        }
示例#2
0
        private static bool UiaGetIsModal(ProdWindow control)
        {
            bool retVal = WindowPatternHelper.GetIsModal(control.UIAElement);

            LogController.ReceiveLogMessage(new LogMessage(retVal.ToString()));
            return(retVal);
        }
示例#3
0
        private static WindowInteractionState UiaGetWindowState(ProdWindow baseControl)
        {
            WindowInteractionState state = WindowPatternHelper.GetInteractionState(baseControl.UIAElement);

            LogController.ReceiveLogMessage(new LogMessage(state.ToString()));
            return(state);
        }
示例#4
0
        private static WindowVisualState UiaGetWindowVisualState(ProdWindow control)
        {
            WindowVisualState retVal = WindowPatternHelper.GetVisualState(control.UIAElement);

            LogController.ReceiveLogMessage(new LogMessage(retVal.ToString()));
            return(retVal);
        }
示例#5
0
 /// <summary>
 /// Closes the specified window
 /// </summary>
 /// <param name="windowHandle">NativeWindowHandle to window</param>
 /// <exception cref="ProdOperationException">Examine inner exception</exception>
 public static void WindowClose(IntPtr windowHandle)
 {
     try
     {
         WindowPatternHelper.CloseWindow(AutomationElement.FromHandle(windowHandle));
     }
     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);
     }
 }
示例#6
0
 /// <summary>
 /// gets the current ready-state of the window
 /// </summary>
 /// <param name="windowHandle">NativeWindowHandle to window</param>
 /// <returns>
 /// The current <see cref="WindowInteractionState"/>
 /// </returns>
 /// <exception cref="ProdOperationException">Examine inner exception</exception>
 public static WindowInteractionState WindowGetWindowState(IntPtr windowHandle)
 {
     try
     {
         return(WindowPatternHelper.GetInteractionState(AutomationElement.FromHandle(windowHandle)));
     }
     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);
     }
 }
示例#7
0
 /// <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);
     }
 }
示例#8
0
 /// <summary>
 /// Causes the calling code to block for the specified time or until the associated process enters an idle state, whichever completes first
 /// </summary>
 /// <param name="windowHandle">NativeWindowHandle to window</param>
 /// <param name="delay">Time, in milliseconds to wait for an idle state</param>
 /// <returns>
 /// true if the window has entered the idle state; false if the timeout occurred
 /// </returns>
 /// <exception cref="ProdOperationException">Examine inner exception</exception>
 public static bool WindowWaitForIdle(IntPtr windowHandle, int delay)
 {
     try
     {
         bool retVal = WindowPatternHelper.WaitForInputIdle(AutomationElement.FromHandle(windowHandle), delay);
         return(retVal);
     }
     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);
     }
 }
示例#9
0
 /// <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);
     }
 }
示例#10
0
        //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"));
        }
示例#11
0
        //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"));
        }