コード例 #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);
 }