예제 #1
0
 private void UnregisterFilter()
 {
     if (_filter != null)
     {
         Application.RemoveMessageFilter(_filter);
         _filter = null;
     }
 }
예제 #2
0
        private void RegisterFilter()
        {
            if (_filter == null)
            {
                // Check that caller has permission to access unmanaged code
                new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Assert();

                try
                {
                    _filter = new SeparatorMessageFilter(this);
                    Application.AddMessageFilter(_filter);
                }
                finally
                {
                    // Always revert the assertion made above
                    CodeAccessPermission.RevertAssert();
                }
            }
        }