protected virtual void Dispose(bool managedAndNative)
        {
            dialogWatcher.Remove(dialogHandler);

            dialogWatcher = null;
            dialogHandler = null;
        }
Пример #2
0
        /// <summary>
        /// Gets the dialog watcher for the specified (main) internet explorer window.
        /// It creates new instance if no dialog watcher for the specified window exists.
        /// </summary>
        /// <param name="mainWindowHwnd">The (main) internet explorer window.</param>
        /// <returns></returns>
        public static DialogWatcher GetDialogWatcher(IntPtr mainWindowHwnd)
        {
            var window = new Window(mainWindowHwnd);

            Logger.LogDebug("GetDialogWatcher mainhwnd: " + window.Hwnd + ", " + window.Title);

            var toplevelWindow = window.ToplevelWindow;

            Logger.LogDebug("GetDialogWatcher mainhwnd: " + toplevelWindow.Hwnd + ", " + toplevelWindow.Title);

            CleanupDialogWatcherCache();

            var dialogWatcher = GetDialogWatcherFromCache(toplevelWindow);

            // If no dialogwatcher exists then
            // create a new one, store it and return it.
            if (dialogWatcher == null)
            {
                dialogWatcher = new DialogWatcher(toplevelWindow);

                dialogWatchers.Add(dialogWatcher);
            }

            return(dialogWatcher);
        }
		protected virtual void Dispose(bool managedAndNative)
		{
			dialogWatcher.Remove(dialogHandler);

			dialogWatcher = null;
			dialogHandler = null;
		}
Пример #4
0
        private void frmWebBowser_Load(object sender, EventArgs e)
        {
            Settings.WaitForCompleteTimeOut = 120000;
            Settings.AttachToBrowserTimeOut = 120000;
           
            webBrowser1.ScriptErrorsSuppressed = false;

            Settings.AutoStartDialogWatcher = false;
            ie = new IE(webBrowser1.ActiveXInstance);
            try
            {
                ie.ClearCache();
            }
            catch
            {
            }
            //ie = new IE();
            dialogWatcher = new DialogWatcher(new Window(this.Handle));
            dialogWatcher.CloseUnhandledDialogs = false;
            webpage = new WebPage();
            lookUpEditPage.Properties.DataSource = WebPage.GetAll();
            lookUpEditPage.Properties.DisplayMember = "Page";
            lookUpEditPage.Properties.ValueMember = "ID";
            if (pageID > 0)
            {
                lookUpEditPage.EditValue = long.Parse(pageID.ToString());
            }
        }
        public UseDialogOnce( DialogWatcher watcher, IDialogHandler handler )
        {
            if ( watcher == null )
                throw new ArgumentNullException( "watcher" );
            if ( handler == null )
                throw new ArgumentNullException( "handler" );

            _watcher = watcher;
            _handler = handler;

            watcher.Add( handler );
        }
        public UseDialogOnce(DialogWatcher dialogWatcher, IDialogHandler dialogHandler)
        {
            if (dialogWatcher == null)
            {
                throw new ArgumentNullException("dialogWatcher");
            }

            if (dialogHandler == null)
            {
                throw new ArgumentNullException("dialogHandler");
            }

            this.dialogWatcher = dialogWatcher;
            this.dialogHandler = dialogHandler;

            dialogWatcher.Add(dialogHandler);
        }
Пример #7
0
        /// <summary>
        /// Gets the dialog watcher for the specified process. It creates
        /// a new instance if no dialog watcher for the specified process
        /// exists.
        /// </summary>
        /// <param name="ieProcessId">The ie process id.</param>
        /// <returns></returns>
        public static DialogWatcher GetDialogWatcherForProcess(int ieProcessId)
        {
            CleanupDialogWatcherCache();

            DialogWatcher dialogWatcher = GetDialogWatcherFromCache(ieProcessId);

            // If no dialogwatcher exists for the ieprocessid then
            // create a new one, store it and return it.
            if (dialogWatcher == null)
            {
                dialogWatcher = new DialogWatcher(ieProcessId);

                dialogWatchers.Add(dialogWatcher);
            }

            return(dialogWatcher);
        }
Пример #8
0
		/// <summary>
		/// Gets the dialog watcher for the specified process. It creates
		/// a new instance if no dialog watcher for the specified process 
		/// exists.
		/// </summary>
		/// <param name="ieProcessId">The ie process id.</param>
		/// <returns></returns>
		public static DialogWatcher GetDialogWatcherForProcess(int ieProcessId)
		{
			CleanupDialogWatcherCache();

			DialogWatcher dialogWatcher = GetDialogWatcherFromCache(ieProcessId);

			// If no dialogwatcher exists for the ieprocessid then 
			// create a new one, store it and return it.
			if (dialogWatcher == null)
			{
				dialogWatcher = new DialogWatcher(ieProcessId);

				dialogWatchers.Add(dialogWatcher);
			}

			return dialogWatcher;
		}
		public UseDialogOnce(DialogWatcher dialogWatcher, IDialogHandler dialogHandler)
		{
			if (dialogWatcher == null)
			{
				throw new ArgumentNullException("dialogWatcher");
			}

			if (dialogHandler == null)
			{
				throw new ArgumentNullException("dialogHandler");
			}

			this.dialogWatcher = dialogWatcher;
			this.dialogHandler = dialogHandler;

			dialogWatcher.Add(dialogHandler);
		}
Пример #10
0
	    /// <summary>
		/// Gets the dialog watcher for the specified (main) internet explorer window. 
		/// It creates new instance if no dialog watcher for the specified window exists.
		/// </summary>
        /// <param name="mainWindowHwnd">The (main) internet explorer window.</param>
		/// <returns></returns>
        public static DialogWatcher GetDialogWatcher(IntPtr mainWindowHwnd)
		{
            var mainHwnd = new Window(mainWindowHwnd).ToplevelWindow.Hwnd;

			CleanupDialogWatcherCache();

            var dialogWatcher = GetDialogWatcherFromCache(mainHwnd);

			// If no dialogwatcher exists for the ieprocessid then 
			// create a new one, store it and return it.
			if (dialogWatcher == null)
			{
                dialogWatcher = new DialogWatcher(mainHwnd);

				dialogWatchers.Add(dialogWatcher);
			}

			return dialogWatcher;
		}
Пример #11
0
        /// <summary>
        /// Gets the dialog watcher for the specified (main) internet explorer window.
        /// It creates new instance if no dialog watcher for the specified window exists.
        /// </summary>
        /// <param name="mainWindowHwnd">The (main) internet explorer window.</param>
        /// <returns></returns>
        public static DialogWatcher GetDialogWatcher(IntPtr mainWindowHwnd)
        {
            var mainHwnd = new Window(mainWindowHwnd).ToplevelWindow.Hwnd;

            CleanupDialogWatcherCache();

            var dialogWatcher = GetDialogWatcherFromCache(mainHwnd);

            // If no dialogwatcher exists for the ieprocessid then
            // create a new one, store it and return it.
            if (dialogWatcher == null)
            {
                dialogWatcher = new DialogWatcher(mainHwnd);

                dialogWatchers.Add(dialogWatcher);
            }

            return(dialogWatcher);
        }
	    /// <summary>
		/// Gets the dialog watcher for the specified (main) internet explorer window. 
		/// It creates new instance if no dialog watcher for the specified window exists.
		/// </summary>
        /// <param name="mainWindowHwnd">The (main) internet explorer window.</param>
		/// <returns></returns>
        public static DialogWatcher GetDialogWatcher(IntPtr mainWindowHwnd)
		{
            var window = new Window(mainWindowHwnd);
            Logger.LogDebug("GetDialogWatcher mainhwnd: " + window.Hwnd + ", " + window.Title);

            var toplevelWindow = window.ToplevelWindow;
            Logger.LogDebug("GetDialogWatcher mainhwnd: " + toplevelWindow.Hwnd + ", " + toplevelWindow.Title);

			CleanupDialogWatcherCache();

            var dialogWatcher = GetDialogWatcherFromCache(toplevelWindow);

			// If no dialogwatcher exists then 
			// create a new one, store it and return it.
			if (dialogWatcher == null)
			{
                dialogWatcher = new DialogWatcher(toplevelWindow);

				dialogWatchers.Add(dialogWatcher);
			}

			return dialogWatcher;
		}
Пример #13
0
		/// <summary>
		/// Call this function (from a subclass) as soon as the process is started.
		/// </summary>
		protected void StartDialogWatcher()
		{
			if (Settings.AutoStartDialogWatcher && _dialogWatcher == null)
			{
				_dialogWatcher = DialogWatcher.GetDialogWatcherForProcess(ProcessID);
				_dialogWatcher.IncreaseReferenceCount();
			}
		}
Пример #14
0
		/// <summary>
		/// This method must be called by its inheritor to dispose references
		/// to internal resources.
		/// </summary>
		protected override void Dispose(bool disposing)
		{
			if (!_disposed)
			{
				_htmlDocument = null;
				if (_dialogWatcher != null)
				{
					DialogWatcher.DecreaseReferenceCount();
					_dialogWatcher = null;
				}
				_disposed = true;

				base.Dispose(true);
			}
		}
Пример #15
0
 public virtual void SetFileUploadFile(DialogWatcher dialogWatcher, string fileName)
 {
     _inner.SetFileUploadFile(dialogWatcher, fileName);
 }
		/// <summary>
		/// This method must be called by its inheritor to dispose references
		/// to internal resources.
		/// </summary>
		protected override void Dispose(bool disposing)
		{
		    if (IsDisposed) return;
		    
            _nativeDocument = null;
		    if (DialogWatcher != null)
		    {
		        DialogWatcher.DecreaseReferenceCount();
		        DialogWatcher = null;
		    }
		    IsDisposed = true;

		    base.Dispose(true);
		}
 public static DialogWatcher GetDialogWatcher(IntPtr mainWindowHwnd)
 {
     Window window = new Window(mainWindowHwnd);
       Logger.LogDebug(string.Concat(new object[4]
       {
     (object) "GetDialogWatcher mainhwnd: ",
     (object) window.Hwnd,
     (object) ", ",
     (object) window.Title
       }), new object[0]);
       Window toplevelWindow = window.ToplevelWindow;
       Logger.LogDebug(string.Concat(new object[4]
       {
     (object) "GetDialogWatcher mainhwnd: ",
     (object) toplevelWindow.Hwnd,
     (object) ", ",
     (object) toplevelWindow.Title
       }), new object[0]);
       DialogWatcher.CleanupDialogWatcherCache();
       DialogWatcher dialogWatcher = DialogWatcher.GetDialogWatcherFromCache(toplevelWindow);
       if (dialogWatcher == null)
       {
     dialogWatcher = new DialogWatcher(toplevelWindow);
     DialogWatcher.dialogWatchers.Add(dialogWatcher);
       }
       return dialogWatcher;
 }
Пример #18
0
 private void frmOption_Load(object sender, EventArgs e)
 {
     _InitData();
     //WatiN.Core.Settings.AutoStartDialogWatcher = false;
     dialogWatcher = new DialogWatcher(new WatiN.Core.Native.Windows.Window(this.Handle));
     dialogWatcher.CloseUnhandledDialogs = false;
 }