예제 #1
0
        /// <summary>
        /// This method is used to check if the agent is running or not
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public static bool CheckIfAgentIsRunning(Activity activity, GingerRunner runner, Context context, out IWindowExplorer windowExplorerDriver)
        {
            bool isRunning = false;

            windowExplorerDriver = null;
            ApplicationAgent appAgent = GetAppAgent(activity, runner, context);

            if (appAgent != null && appAgent.Agent != null && appAgent.Agent.Driver != null && appAgent.Agent.Driver.IsRunning())
            {
                if (appAgent.Agent.Driver is IWindowExplorer)
                {
                    windowExplorerDriver = (IWindowExplorer)appAgent.Agent.Driver;
                }
                isRunning = true;
            }
            return(isRunning);
        }
예제 #2
0
        /// <summary>
        /// This method is used to Start the agent
        /// </summary>
        public static bool StartAgent(Activity activity, GingerRunner runner, Context context, out IWindowExplorer windowExplorerDriver)
        {
            bool isAgentStarted = false;

            windowExplorerDriver = null;
            ApplicationAgent appAgent = GetAppAgent(activity, runner, context);

            if (appAgent != null)
            {
                if (appAgent.Agent.Driver == null)
                {
                    appAgent.Agent.StartDriver();
                    isAgentStarted = true;
                }
                else if (!appAgent.Agent.Driver.IsRunning())
                {
                    if (Reporter.ToUser(eUserMsgKey.PleaseStartAgent, eUserMsgOption.OKCancel, eUserMsgSelection.OK) == eUserMsgSelection.OK)
                    {
                        appAgent.Agent.StartDriver();
                        isAgentStarted = true;
                    }
                    else
                    {
                        isAgentStarted = false;
                    }
                }
                DriverBase driver = appAgent.Agent.Driver;
                if (driver is IWindowExplorer)
                {
                    windowExplorerDriver = (IWindowExplorer)appAgent.Agent.Driver;
                }
            }
            else
            {
                isAgentStarted = false;
            }
            return(isAgentStarted);
        }
예제 #3
0
 public void SetWindowExplorer(IWindowExplorer windowExplorerDriver)
 {
     mWinExplorer = windowExplorerDriver;
     mappedUIElementsPage.SetWindowExplorer(windowExplorerDriver);
     unmappedUIElementsPage.SetWindowExplorer(windowExplorerDriver);
 }