Dispose() public method

public Dispose ( ) : void
return void
 // Runs on our Automation thread
 void InstallLocationMonitor(IntPtr hWnd)
 {
     if (_windowLocationWatcher != null)
     {
         _windowLocationWatcher.Dispose();
     }
     _windowLocationWatcher = new WindowLocationWatcher(hWnd, _syncContextAuto);
     _windowLocationWatcher.LocationChanged += _windowLocationWatcher_LocationChanged;
 }
示例#2
0
        // Runs on the main thread
        public void Dispose()
        {
            Debug.Assert(Thread.CurrentThread.ManagedThreadId == 1);

            Logger.WindowWatcher.Verbose("FormulaEdit Dispose Begin");
            _windowWatcher.FormulaBarWindowChanged -= _windowWatcher_FormulaBarWindowChanged;
            _windowWatcher.InCellEditWindowChanged -= _windowWatcher_InCellEditWindowChanged;

            // Can't call UninstallLocationMonitor - we might be shutting down on the main thread, and don't want to post
            WindowLocationWatcher tempWatcher = Interlocked.Exchange(ref _windowLocationWatcher, null);

            if (tempWatcher != null)
            {
                tempWatcher.Dispose();
            }
            Logger.WindowWatcher.Verbose("FormulaEdit Dispose End");
        }