Exemplo n.º 1
0
        public static void Minimize(AutomationElement element)
        {
            WindowPattern currentPattern = AutomationPatternHelper.GetWindowPattern(element);

            if (currentPattern.Current.CanMinimize)
            {
                currentPattern.SetWindowVisualState(WindowVisualState.Minimized);
            }
        }
Exemplo n.º 2
0
        public static void AssertReadyForUserInteraction(AutomationElement element)
        {
            WindowPattern          currentPattern         = AutomationPatternHelper.GetWindowPattern(element);
            WindowInteractionState windowInteractionState = currentPattern.Current.WindowInteractionState;

            if (windowInteractionState != WindowInteractionState.ReadyForUserInteraction)
            {
                throw new Exception(string.Format("Window is not ready for user interaction. State is {0}. ({1})", windowInteractionState.ToString(), element.ToString()));
            }
        }
Exemplo n.º 3
0
 public static string GetWindowState(AutomationElement element)
 {
     try
     {
         WindowPattern currentPattern = AutomationPatternHelper.GetWindowPattern(element);
         return(currentPattern.Current.WindowInteractionState.ToString());
     }
     catch (Exception exception)
     {
         return("Unable to retrieve window state. " + exception.Message);
     }
 }
Exemplo n.º 4
0
 public static void Restore(AutomationElement element)
 {
     AutomationPatternHelper.GetWindowPattern(element).SetWindowVisualState(WindowVisualState.Normal);
 }