예제 #1
0
 public void UnregisterCallbackWindow()
 {
     lock (instanceLock)
     {
         // Release handle
         if (callbackWindow != null)
         {
             callbackWindow.Detach();
             callbackWindow = null;
         }
     }
 }
예제 #2
0
        public Int32 RegisterWithEvents(String signature, String title, String icon, String password, IntPtr hWndReplyTo, Int32?msgReply)
        {
            lock (instanceLock)
            {
                if (msgReply == null || msgReply.Value == 0)
                {
                    msgReply = WM_DEFAULT_APPMSG;
                }

                // Reuse callbackwindo as is, if DetachCallbackWindow() hasn't been called manually
                if (callbackWindow == null)
                {
                    callbackWindow = new SnarlCallbackNativeWindow(this, hWndReplyTo);
                }

                return(Register(signature, title, icon, password, callbackWindow.Handle, msgReply.Value));
            }
        }
예제 #3
0
 public void UnregisterCallbackWindow()
 {
     lock (instanceLock)
     {
         // Release handle
         if (callbackWindow != null)
         {
             callbackWindow.Detach();
             callbackWindow = null;
         }
     }
 }
예제 #4
0
        public Int32 RegisterWithEvents(String signature, String title, String icon, String password, IntPtr hWndReplyTo, Int32? msgReply)
        {
            lock (instanceLock)
            {
                if (msgReply == null || msgReply.Value == 0)
                    msgReply = WM_DEFAULT_APPMSG;

                // Reuse callbackwindo as is, if DetachCallbackWindow() hasn't been called manually
                if (callbackWindow == null)
                    callbackWindow = new SnarlCallbackNativeWindow(this, hWndReplyTo);

                return Register(signature, title, icon, password, callbackWindow.Handle, msgReply.Value);
            }
        }
예제 #5
0
 /// <summary>
 /// Releases the callback window.
 /// </summary>
 private void UnregisterCallbackWindow()
 {
     if (callbackWindow != null)
     {
         lock (instanceLock)
         {
             if (callbackWindow != null)
             {
                 callbackWindow.Detach();
                 callbackWindow = null;
             }
         }
     }
 }
예제 #6
0
        /// <summary>
        /// Register with Snarl and hook the window supplied in hWndReplyTo, enabling SnarlInterface
        /// to send the CallbackEvent and GlobalSnarlEvent.
        /// </summary>
        /// <param name="appSignatur">The application's signature.</param>
        /// <param name="title">The application's name.</param>
        /// <param name="password">Password used during registration.</param>
        /// <param name="icon">(Optional) The icon to use.</param>
        /// <param name="hWndReply">(Optional) The handle to a window (HWND) which Snarl should post events to.
        ///     If parameter is eqaul to IntPtr.Zero or omitted a new listening Window will be created.</param>
        /// <param name="msgReply">(Optional) The message Snarl should use to post to the hWndReply Window. If 0 or omitted a default value will be used.</param>
        /// <remarks><see cref="https://sites.google.com/site/snarlapp/developers/api-reference#TOC-register"/></remarks>
        /// <remarks>This is not part of the official API, but enables the SnarlInterface class to send events.</remarks>
        public Int32 RegisterWithEvents(String appSignatur, String title, String password,
                                        String icon = null, IntPtr hWndReplyTo = default(IntPtr), Int32 msgReply = 0)
        {
            if (msgReply == 0)
                msgReply = WM_DEFAULT_APPMSG;

            lock (instanceLock)
            {
                UnregisterCallbackWindow();
                callbackWindow = new SnarlCallbackNativeWindow(this, hWndReplyTo);
            }

            return Register(appSignatur, title, password, icon, callbackWindow.Handle, msgReply);
        }