void InitializeShellMonitor()
        {
            NotifyWindow nw = new NotifyWindow(this);
            uint cookie = 0;
            try
            {
                NativeMethods.SHChangeNotifyEntry what;
                what.pIdl = IntPtr.Zero;
                what.Recursively = true;

                // We are only interested in Shell events. We let VS handle the real filesystem changes

                // TortoiseSVN has to notify the shell for all his updates, and we just listen to what TortoiseSVN sends us :)

                cookie = NativeMethods.SHChangeNotifyRegister(nw.Handle, 0x0002 | 0x8000, NativeMethods.SHCNE.SHCNE_ALLEVENTS, 0xDEDE, 1, ref what);
            }
            catch(Exception e)
            {
                GC.KeepAlive(e);
                if (nw != null)
                {
                    nw.Dispose();
                    nw = null;
                }
            }
            finally
            {
                _notifyWindow = nw;
                _notifyCookie = cookie;
            }
        }
        void InitializeShellMonitor()
        {
            NotifyWindow nw     = new NotifyWindow(this);
            uint         cookie = 0;

            try
            {
                NativeMethods.SHChangeNotifyEntry what;
                what.pIdl        = IntPtr.Zero;
                what.Recursively = true;

                // We are only interested in Shell events. We let VS handle the real filesystem changes

                // TortoiseSVN has to notify the shell for all his updates, and we just listen to what TortoiseSVN sends us :)

                cookie = NativeMethods.SHChangeNotifyRegister(nw.Handle, 0x0002 | 0x8000, NativeMethods.SHCNE.SHCNE_ALLEVENTS, 0xDEDE, 1, ref what);
            }
            catch (Exception e)
            {
                GC.KeepAlive(e);
                if (nw != null)
                {
                    nw.Dispose();
                    nw = null;
                }
            }
            finally
            {
                _notifyWindow = nw;
                _notifyCookie = cookie;
            }
        }