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

            if (currentPattern.Current.CanMinimize)
            {
                currentPattern.SetWindowVisualState(WindowVisualState.Minimized);
            }
        }
Esempio 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()));
            }
        }
Esempio 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);
     }
 }
Esempio n. 4
0
 public static void Restore(AutomationElement element)
 {
     AutomationPatternHelper.GetWindowPattern(element).SetWindowVisualState(WindowVisualState.Normal);
 }