Beispiel #1
0
        protected void Dispose(bool disposing)

        {
            if (disposing)

            {
                try

                {
                    if (this.udp != null)

                    {
                        this.udp.PacketReceived -= new UdpListener.PacketHandler(udp_PacketReceived);

                        this.udp.Dispose();

                        this.udp = null;
                    }
                }

                catch

                {
                    // suppress
                }
            }
        }
Beispiel #2
0
        /// <summary>

        /// Stops listening for incoming notifications

        /// </summary>

        public virtual void Stop()

        {
            try

            {
                if (this.udp != null)

                {
                    this.udp.PacketReceived -= new UdpListener.PacketHandler(udp_PacketReceived);

                    this.udp.Stop();

                    this.udp.Dispose();
                }

                this.udp = null;
            }

            catch

            {
                // swallow any exceptions (this handles the case when Growl is stopped while still listening for network notifications)
            }

            finally

            {
                this.isRunning = false;
            }
        }
Beispiel #3
0
        /// <summary>

        /// Starts listening for incoming notifications

        /// </summary>

        public virtual bool Start()

        {
            if (!this.isRunning)

            {
                try

                {
                    // start listening for incoming notifications

                    this.udp = new UdpListener(this.port, false);

                    this.udp.PacketReceived += new UdpListener.PacketHandler(udp_PacketReceived);

                    this.udp.Start();

                    this.isRunning = true;
                }

                catch (Exception ex)

                {
                    DebugInfo.WriteLine(String.Format("UDP Listener failed to start on port {0}: {1}", this.Port, ex.ToString()));

                    this.isRunning = false;
                }
            }

            return(this.isRunning);
        }
 protected void Dispose(bool disposing)
 {
     if (disposing)
     {
         try
         {
             if (this.udp != null)
             {
                 this.udp.PacketReceived -= new UdpListener.PacketHandler(udp_PacketReceived);
                 this.udp.Dispose();
                 this.udp = null;
             }
         }
         catch
         {
             // suppress
         }
     }
 }
 /// <summary>
 /// Stops listening for incoming notifications
 /// </summary>
 public virtual void Stop()
 {
     try
     {
         if (this.udp != null)
         {
             this.udp.PacketReceived -= new UdpListener.PacketHandler(udp_PacketReceived);
             this.udp.Stop();
             this.udp.Dispose();
         }
         this.udp = null;
     }
     catch
     {
         // swallow any exceptions (this handles the case when Growl is stopped while still listening for network notifications)
     }
     finally
     {
         this.isRunning = false;
     }
 }
 /// <summary>
 /// Starts listening for incoming notifications
 /// </summary>
 public virtual bool Start()
 {
     if (!this.isRunning)
     {
         try
         {
             // start listening for incoming notifications
             this.udp = new UdpListener(this.port, false);
             this.udp.PacketReceived += new UdpListener.PacketHandler(udp_PacketReceived);
             this.udp.Start();
             this.isRunning = true;
         }
         catch(Exception ex)
         {
             DebugInfo.WriteLine(String.Format("UDP Listener failed to start on port {0}: {1}", this.Port, ex.ToString()));
             this.isRunning = false;
         }
     }
     return this.isRunning;
 }