Exemplo n.º 1
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         lock (_threadlock) {
             _listeners.Remove(WindowHandle);
             if (_listeners.Count == 0)
             {
                 CoreNativeMethods.PostMessage(WindowHandle, WindowMessage.Destroy, IntPtr.Zero, IntPtr.Zero);
             }
         }
     }
 }
Exemplo n.º 2
0
        private void CrossThreadCreateWindow()
        {
            if (_firstWindowHandle == IntPtr.Zero)
            {
                throw new InvalidOperationException(LocalizedMessages.MessageListenerNoWindowHandle);
            }

            lock (_crossThreadWindowLock) {
                CoreNativeMethods.PostMessage(_firstWindowHandle, (WindowMessage)CreateWindowMessage, IntPtr.Zero, IntPtr.Zero);
                Monitor.Wait(_crossThreadWindowLock);
            }

            WindowHandle = _tempHandle;
        }