コード例 #1
0
ファイル: BrowserWindow.cs プロジェクト: windtwf/Myrepos
        /// <summary>
        /// Find a browser window by title of the same browser type as this object
        /// </summary>
        /// <param name="possibleWindowTitles">An array of the possible browser window titles to look for</param>
        /// <param name="ignorePreviouslyAttachedWindows">If true, ignore any windows that have previously been attached to by the framework</param>
        /// <param name="isModal">
        /// Whether or not the window to attach to is modal, meaning a child window that requires user interaction
        /// before being able to return to operating the parent window
        /// </param>
        /// <param name="timeoutMs">The duration in milliseconds to try to find the popup window</param>
        /// <returns>The reference to the browser window</returns>
        public BrowserWindow FindPopupBrowserWindow(string[] possibleWindowTitles, bool ignorePreviouslyAttachedWindows = true, bool isModal = false, int timeoutMs = 5000)
        {
            int originalTimeout = TfsBrowserWindow.FrameworkAgent.FindBrowserWindowTimeout;

            TfsBrowserWindow.FrameworkAgent.FindBrowserWindowTimeout = timeoutMs;

            try
            {
                IWebBrowserWindow popup = (possibleWindowTitles.Length == 1) ?
                                          TfsBrowserWindow.GetPopupWindow(possibleWindowTitles[0], isModal, ignorePreviouslyAttachedWindows) :
                                          TfsBrowserWindow.GetPopupWindow(possibleWindowTitles, isModal, ignorePreviouslyAttachedWindows);

                return(new BrowserWindow(popup));
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                TfsBrowserWindow.FrameworkAgent.FindBrowserWindowTimeout = originalTimeout;
            }
        }