/// <summary> /// This method is used to get the new WindowExplorerPage based on Context and Agent /// </summary> /// <returns></returns> private void LoadWindowExplorerPage() { this.Dispatcher.Invoke(() => { bool isLoaded = false; if (mWinExplorerPageList != null && mWinExplorerPageList.Count > 0) { AgentPageMappingHelper objHelper = mWinExplorerPageList.Where(x => x.ObjectAgent.DriverType == mContext.Agent.DriverType && x.ObjectAgent.ItemName == mContext.Agent.ItemName).FirstOrDefault(); if (objHelper != null && objHelper.ObjectWindowPage != null) { mCurrentLoadedPage = (WindowExplorerPage)objHelper.ObjectWindowPage; isLoaded = true; } } if (!isLoaded) { ApplicationAgent appAgent = AgentHelper.GetAppAgent(mContext.BusinessFlow.CurrentActivity, (GingerExecutionEngine)mContext.Runner, mContext); if (appAgent != null) { mCurrentLoadedPage = new WindowExplorerPage(appAgent, mContext); mCurrentLoadedPage.SetDriver(WindowExplorerDriver); if (mWinExplorerPageList == null) { mWinExplorerPageList = new List <AgentPageMappingHelper>(); } mWinExplorerPageList.Add(new AgentPageMappingHelper(mContext.Agent, mCurrentLoadedPage)); } } xSelectedItemFrame.Content = mCurrentLoadedPage; }); }
/// <summary> /// This method is used to get the new LiveSpyPage based on Context and Agent /// </summary> /// <returns></returns> private void LoadLiveSpyPage(Context context) { this.Dispatcher.Invoke(() => { bool isLoaded = false; if (mLiveSpyPageDictonary != null && mLiveSpyPageDictonary.Count > 0 && context.Agent != null) { AgentPageMappingHelper objHelper = mLiveSpyPageDictonary.Find(x => x.ObjectAgent.DriverType == context.Agent.DriverType && x.ObjectAgent.ItemName == context.Agent.ItemName); if (objHelper != null && objHelper.ObjectWindowPage != null) { mCurrentLoadedPage = (LiveSpyPage)objHelper.ObjectWindowPage; isLoaded = true; } } if (!isLoaded) { ApplicationAgent appAgent = AgentHelper.GetAppAgent(mContext.BusinessFlow.CurrentActivity, mContext.Runner, mContext); if (appAgent != null) { mCurrentLoadedPage = new LiveSpyPage(mContext, mDriver); if (mLiveSpyPageDictonary == null) { mLiveSpyPageDictonary = new List <AgentPageMappingHelper>(); } mLiveSpyPageDictonary.Add(new AgentPageMappingHelper(context.Agent, mCurrentLoadedPage)); } } xSelectedItemFrame.Content = mCurrentLoadedPage; }); }