Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        /// <param name="targetWindow">app window to highlight</param>
        /// <param name="form">Scanner form</param>
        public WindowHighlight(IntPtr targetWindow, Form form)
        {
            _form          = form;
            _outlineWindow = new OutlineWindow(form);

            try
            {
                _automationElement = AutomationElement.FromHandle(targetWindow);
                startTimer();
            }
            catch (Exception ex)
            {
                Log.Debug(ex.ToString());
                _automationElement = null;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Disposer. Release resources and cleanup.
        /// </summary>
        /// <param name="disposing">true to dispose managed resources</param>
        protected virtual void Dispose(bool disposing)
        {
            // Check to see if Dispose has already been called.
            if (!_disposed)
            {
                Log.Debug();

                if (disposing)
                {
                    // dispose all managed resources.
                    Log.Debug();

                    stopTimer();

                    if (_outlineWindow != null)
                    {
                        try
                        {
                            Log.Debug("Disposing highlight overlay window");
                            _outlineWindow.Dispose();
                            _outlineWindow = null;
                        }
                        catch (Exception ex)
                        {
                            Log.Debug(ex.ToString());
                        }
                    }

                    _automationElement = null;
                }

                // Release unmanaged resources.
            }

            _disposed = true;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Disposer. Release resources and cleanup.
        /// </summary>
        /// <param name="disposing">true to dispose managed resources</param>
        protected virtual void Dispose(bool disposing)
        {
            // Check to see if Dispose has already been called.
            if (!_disposed)
            {
                Log.Debug();

                if (disposing)
                {
                    // dispose all managed resources.
                    Log.Debug();

                    stopTimer();

                    if (_outlineWindow != null)
                    {
                        try
                        {
                            Log.Debug("Disposing highlight overlay window");
                            _outlineWindow.Dispose();
                            _outlineWindow = null;
                        }
                        catch (Exception ex)
                        {
                            Log.Debug(ex.ToString());
                        }
                    }

                    _automationElement = null;
                }

                // Release unmanaged resources.
            }

            _disposed = true;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        /// <param name="targetWindow">app window to highlight</param>
        /// <param name="form">Scanner form</param>
        public WindowHighlight(IntPtr targetWindow, Form form)
        {
            _form = form;
            _outlineWindow = new OutlineWindow(form);

            try
            {
                _automationElement = AutomationElement.FromHandle(targetWindow);
                startTimer();
            }
            catch (Exception ex)
            {
                Log.Debug(ex.ToString());
                _automationElement = null;
            }
        }