Exemplo n.º 1
0
 private void StartBonjour()
 {
     if (Bonjour.IsSupported)
     {
         this.bonjour = new Bonjour();
         this.bonjour.ServiceFound += new Bonjour.NetServiceFoundEventHandler(bonjour_ServiceFound);
         this.bonjour.ServiceRemoved += new Bonjour.NetServiceRemovedEventHandler(bonjour_ServiceRemoved);
         this.bonjour.Start();
     }
 }
Exemplo n.º 2
0
 void bonjour_ServiceRemoved(Bonjour sender, IResolvableService service)
 {
     BonjourForwardDestination bfc = MatchBonjourServiceToForwardDestination(service);
     if (bfc != null)
     {
         bfc.NotAvailable();
         OnBonjourServiceUpdate(bfc);
     }
 }
Exemplo n.º 3
0
        private void Dispose(bool disposing)
        {
            if (!this.disposed)
            {
                if (disposing)
                {
                    if (this.mutex != null)
                    {
                        try
                        {
                            this.mutex.ReleaseMutex();
                            this.mutex.Close();
                            this.mutex = null;
                        }
                        catch
                        {
                        }
                    }

                    DisplayStyleManager.DisplayLoaded -= new DisplayStyleManager.DisplayLoadedEventHandler(DisplayStyleManager_DisplayLoaded);

                    if (this.bonjour != null)
                    {
                        this.bonjour.ServiceFound -= new Bonjour.NetServiceFoundEventHandler(bonjour_ServiceFound);
                        this.bonjour.ServiceRemoved -= new Bonjour.NetServiceRemovedEventHandler(bonjour_ServiceRemoved);
                        this.bonjour.Stop();
                        this.bonjour.Dispose();
                        this.bonjour = null;
                    }

                    if (this.activityMonitor != null)
                    {
                        this.activityMonitor.WentIdle -= new ActivityMonitor.ActivityMonitorEventHandler(activityMonitor_WentIdle);
                        this.activityMonitor.ResumedActivity -= new ActivityMonitor.ActivityMonitorEventHandler(activityMonitor_ResumedActivity);
                        this.activityMonitor.StillActive -= new EventHandler(activityMonitor_StillActive);
                        this.activityMonitor.Dispose();
                        this.activityMonitor = null;
                    }

                    if (this.gntpListener != null)
                    {
                        this.gntpListener.RegisterReceived -= new Growl.Daemon.GrowlServer.RegisterReceivedEventHandler(gntpListener_RegisterReceived);
                        this.gntpListener.NotifyReceived -= new Growl.Daemon.GrowlServer.NotifyReceivedEventHandler(gntpListener_NotifyReceived);
                        this.gntpListener.SubscribeReceived -= new Growl.Daemon.GrowlServer.SubscribeReceivedEventHandler(gntpListener_SubscribeReceived);
                        this.gntpListener.Dispose();
                        this.gntpListener = null;
                    }

                    if (this.udpListener != null)
                    {
                        this.udpListener.RegistrationReceived -= new Growl.UDPLegacy.MessageReceiver.RegistrationHandler(udpListener_RegistrationReceived);
                        this.udpListener.NotificationReceived -= new Growl.UDPLegacy.MessageReceiver.NotificationHandler(udpListener_NotificationReceived);
                        this.udpListener.Dispose();
                        this.udpListener = null;
                    }

                    if (this.udpListenerLocal != null)
                    {
                        this.udpListenerLocal.RegistrationReceived -= new Growl.UDPLegacy.MessageReceiver.RegistrationHandler(udpListener_RegistrationReceived);
                        this.udpListenerLocal.NotificationReceived -= new Growl.UDPLegacy.MessageReceiver.NotificationHandler(udpListener_NotificationReceived);
                        this.udpListenerLocal.Dispose();
                        this.udpListenerLocal = null;
                    }

                    if (this.subscriptions != null)
                    {
                        foreach (Subscription subscription in this.subscriptions.Values)
                        {
                            subscription.StatusChanged -= new Subscription.SubscriptionStatusChangedEventHandler(subscription_StatusChanged);
                        }
                    }

                    if (this.forwards != null)
                    {
                        foreach (ForwardDestination fd in this.forwards.Values)
                        {
                            SubscribedForwardDestination sfd = fd as SubscribedForwardDestination;
                            if(sfd != null)
                                sfd.Unsubscribed -= new SubscribedForwardDestination.SubscribingComputerUnscubscribedEventHandler(sfc_Unsubscribed);
                        }
                    }

                    if (DisplayStyleManager.AvailableDisplayStyles != null)
                    {
                        foreach (Display display in DisplayStyleManager.AvailableDisplayStyles.Values)
                        {
                            display.NotificationCallback -= new Display.NotificationCallbackEventHandler(display_NotificationCallback);
                        }
                    }
                }
                this.disposed = true;
            }
        }
Exemplo n.º 4
0
 void bonjour_ServiceFound(Bonjour sender, IResolvableService service, BonjourEventArgs args)
 {
     BonjourForwardDestination bfc = MatchBonjourServiceToForwardDestination(service);
     if (bfc != null)
     {
         bfc.Update(service, args);
         OnBonjourServiceUpdate(bfc);
     }
 }