示例#1
0
 public static void ConstructProcessWait <T>(this NormalWindowProxy <T> normalWindow, ConstructSymbol <ProcessEntity> .From <T> symbol, int?timeout = null) where T : Entity
 {
     using (var pe = normalWindow.ConstructFrom(symbol))
     {
         pe.WaitFinished(() => "Waiting for process after {0} to finish".FormatWith(symbol.Symbol), timeout);
     }
 }
示例#2
0
        public static NormalWindowProxy <T> ConstructFrom <F, FB, T>(this NormalWindowProxy <F> window, ConstructSymbol <T> .From <FB> symbol, int?timeOut = null)
            where T : Entity
            where FB : class, IEntity
            where F : Entity, FB
        {
            AutomationElement element = window.OperationCapture(symbol.Symbol, timeOut);

            return(new NormalWindowProxy <T>(element));
        }
示例#3
0
        public static void Execute <T>(this NormalWindowProxy <T> window, ExecuteSymbol <T> symbol, int?timeOut = null)
            where T : Entity
        {
            var entityId = window.EntityId;
            var button   = window.GetOperationButton(symbol.Symbol);

            window.Element.WaitDataContextChangedAfter(
                action: () => button.ButtonInvoke(),
                timeOut: timeOut ?? OperationTimeouts.ExecuteTimeout,
                actionDescription: () => "Executing {0} from {1}".FormatWith(symbol.Symbol, entityId));
        }
示例#4
0
        public static AutomationElement OperationCapture <T>(this NormalWindowProxy <T> window, OperationSymbol operationSymbol, int?timeOut = null)
            where T : Entity
        {
            var time     = timeOut ?? OperationTimeouts.ConstructFromTimeout;
            var entityId = window.EntityId;

            var button = window.GetOperationButton(operationSymbol);

            return(window.Element.CaptureWindow(
                       () => button.ButtonInvoke(),
                       actionDescription: () => "Finding a window after {0} from {1} took more than {2} ms".FormatWith(operationSymbol.Key, entityId, time)));
        }
示例#5
0
        public static void OperationDialog <T>(this NormalWindowProxy <T> window, OperationSymbol operationSymbol, Action <AutomationElement> dialogAction, int?timeOut = null)
            where T : Entity
        {
            var time     = timeOut ?? OperationTimeouts.ExecuteTimeout;
            var entityId = window.EntityId;
            var button   = window.ButtonBar.GetButton(operationSymbol);

            window.Element.WaitDataContextChangedAfter(
                action: () =>
            {
                var dialog = window.Element.CaptureWindow(action: () => button.ButtonInvoke(),
                                                          actionDescription: () => "Executing {0} from {1} and waiting to capture window".FormatWith(operationSymbol.Key, entityId));

                dialogAction(dialog);
            },
                actionDescription: () => "Executing {0} from {1}".FormatWith(operationSymbol.Key, entityId));
        }
示例#6
0
        public static AutomationElement GetOperationButton <T>(this NormalWindowProxy <T> window, OperationSymbol operationSymbol)
            where T : Entity
        {
            var result = window.ButtonBar.TryGetButton(operationSymbol);

            if (result != null)
            {
                return(result);
            }

            result = (from sc in window.MainControl.Descendants(a => a.Current.ClassName == "SearchControl").Select(sc => new SearchControlProxy(sc))
                      select sc.GetOperationButton(operationSymbol)).NotNull().FirstOrDefault();
            if (result != null)
            {
                return(result);
            }

            throw new ElementNotFoundException("Button for operation {0} not found on the ButtonBar or any visible SearchControl".FormatWith(operationSymbol.Key));
        }
示例#7
0
 public static Lite <IsolationEntity> GetIsolation <T>(this NormalWindowProxy <T> window)
     where T : Entity
 {
     throw new NotImplementedException();
 }
示例#8
0
 public static bool IsOperationEnabled <T>(this NormalWindowProxy <T> window, OperationSymbol operationSymbol)
     where T : Entity
 {
     return(window.ButtonBar.GetButton(operationSymbol).Current.IsEnabled);
 }
示例#9
0
 public static AutomationElement ExecuteCapture <T>(this NormalWindowProxy <T> window, ExecuteSymbol <T> symbol, int?timeOut = null)
     where T : Entity
 {
     return(window.OperationCapture(symbol.Symbol, timeOut));
 }
示例#10
0
 public static Lite <T> Lite <T>(this NormalWindowProxy <T> entity) where T : Entity
 {
     return((Lite <T>)NormalWindowExtensions.ParseLiteHash(entity.Element.Current.ItemStatus));
 }
示例#11
0
 private static void WaitFinished(this NormalWindowProxy <ProcessEntity> pe, Func <string> actionDescription, int?timeout = null)
 {
     pe.Element.Wait(() => pe.ValueLineValue(pe2 => pe2.State) == ProcessState.Finished,
                     () => "{0}, result state is {1}".FormatWith((actionDescription != null ? actionDescription() : "Waiting for process to finish"), pe.ValueLineValue(pe2 => pe2.State)),
                     timeout ?? DefaultTimeout);
 }