public void Dispose ()
        {
            if (locator != null) {
                locator.Stop ();
                locator.Found -= OnServiceFound;
                locator.Removed -= OnServiceRemoved;
                locator = null;
            }

            if (proxy_server != null) {
                proxy_server.Stop ();
                proxy_server = null;
            }

            // Dispose any remaining child sources
            if (source_map != null) {
                foreach (KeyValuePair <string, DaapSource> kv in source_map) {
                    if (kv.Value != null) {
                        kv.Value.Disconnect (true);
                        kv.Value.Dispose ();
                    }
                }

                source_map.Clear ();
            }

            if (container != null) {
                ServiceManager.SourceManager.RemoveSource (container, true);
                container = null;
            }
        }
Esempio n. 2
0
        public bool DelayedInitializeTimeout()
        {
            // Add the source, even though its empty, so that the user sees the
            // plugin is enabled, just no child sources yet.
            source_map = new Dictionary <string, DaapSource> ();
            container  = new DaapContainerSource();

            try {
                // Now start looking for services.
                // We do this after creating the source because if we do it before
                // there's a race condition where we get a service before the source
                // is added.
                locator                   = new ServiceLocator();
                locator.Found            += OnServiceFound;
                locator.Removed          += OnServiceRemoved;
                locator.ShowLocalServices = true;
                locator_started           = DateTime.Now;
                locator.Start();

                proxy_server = new DaapProxyWebServer();
                proxy_server.Start();
            } catch (Exception e) {
                Hyena.Log.Exception("Failed to start DAAP client", e);
            }
            return(false);
        }
Esempio n. 3
0
        public void Dispose()
        {
            if (locator != null)
            {
                locator.Stop();
                locator.Found   -= OnServiceFound;
                locator.Removed -= OnServiceRemoved;
                locator          = null;
            }

            if (proxy_server != null)
            {
                proxy_server.Stop();
                proxy_server = null;
            }

            var uia_service = ServiceManager.Get <InterfaceActionService> ();

            if (uia_service != null)
            {
                uia_service.UIManager.RemoveUi(actions_id);
                uia_service.GlobalActions.Remove("AddRemoteDaapServerAction");
            }

            // Dispose any remaining child sources
            if (source_map != null)
            {
                foreach (KeyValuePair <string, DaapSource> kv in source_map)
                {
                    if (kv.Value != null)
                    {
                        kv.Value.Disconnect(true);
                        kv.Value.Dispose();
                    }
                }

                source_map.Clear();
            }

            if (container != null)
            {
                ServiceManager.SourceManager.RemoveSource(container, true);
                container = null;
            }
        }
Esempio n. 4
0
        public void ThreadedInitialize()
        {
            source_map = new Dictionary <string, DaapSource> ();
            container  = new DaapContainerSource();

            try {
                // Now start looking for services.
                // We do this after creating the source because if we do it before
                // there's a race condition where we get a service before the source
                // is added.
                locator                   = new ServiceLocator();
                locator.Found            += OnServiceFound;
                locator.Removed          += OnServiceRemoved;
                locator.ShowLocalServices = true;
                locator_started           = DateTime.Now;
                locator.Start();

                proxy_server = new DaapProxyWebServer();
                proxy_server.Start();
            } catch (Exception e) {
                Log.Error("Failed to start DAAP client", e);
            }

            var uia_service = ServiceManager.Get <InterfaceActionService> ();

            if (uia_service != null)
            {
                ThreadAssist.ProxyToMain(() => {
                    uia_service.GlobalActions.Add(
                        new ActionEntry("AddRemoteDaapServerAction", Stock.Add,
                                        Catalog.GetString("Add Remote DAAP Server"), null,
                                        Catalog.GetString("Add a new remote DAAP server"),
                                        OnAddRemoteServer)
                        );
                    actions_id = uia_service.UIManager.AddUiFromResource("GlobalUI.xml");
                });
            }
        }
Esempio n. 5
0
        public void Dispose()
        {
            if (locator != null)
            {
                locator.Stop();
                locator.Found   -= OnServiceFound;
                locator.Removed -= OnServiceRemoved;
                locator          = null;
            }

            if (proxy_server != null)
            {
                proxy_server.Stop();
                proxy_server = null;
            }

            // Dispose any remaining child sources
            if (source_map != null)
            {
                foreach (KeyValuePair <string, DaapSource> kv in source_map)
                {
                    if (kv.Value != null)
                    {
                        kv.Value.Disconnect(true);
                        kv.Value.Dispose();
                    }
                }

                source_map.Clear();
            }

            if (container != null)
            {
                ServiceManager.SourceManager.RemoveSource(container, true);
                container = null;
            }
        }
Esempio n. 6
0
        public void Dispose ()
        {
            if (locator != null) {
                locator.Stop ();
                locator.Found -= OnServiceFound;
                locator.Removed -= OnServiceRemoved;
                locator = null;
            }

            if (proxy_server != null) {
                proxy_server.Stop ();
                proxy_server = null;
            }

            var uia_service = ServiceManager.Get<InterfaceActionService> ();
            if (uia_service != null) {
                uia_service.UIManager.RemoveUi (actions_id);
                uia_service.GlobalActions.Remove ("AddRemoteDaapServerAction");
            }

            // Dispose any remaining child sources
            if (source_map != null) {
                foreach (KeyValuePair <string, DaapSource> kv in source_map) {
                    if (kv.Value != null) {
                        kv.Value.Disconnect (true);
                        kv.Value.Dispose ();
                    }
                }

                source_map.Clear ();
            }

            if (container != null) {
                ServiceManager.SourceManager.RemoveSource (container, true);
                container = null;
            }
        }
        public void ThreadedInitialize ()
        {
            // Add the source, even though its empty, so that the user sees the
            // plugin is enabled, just no child sources yet.
            source_map = new Dictionary<string, DaapSource> ();
            container = new DaapContainerSource ();

            try {
                // Now start looking for services.
                // We do this after creating the source because if we do it before
                // there's a race condition where we get a service before the source
                // is added.
                locator = new ServiceLocator ();
                locator.Found += OnServiceFound;
                locator.Removed += OnServiceRemoved;
                locator.ShowLocalServices = true;
                locator_started = DateTime.Now;
                locator.Start ();

                proxy_server = new DaapProxyWebServer ();
                proxy_server.Start ();
            } catch (Exception e) {
                Log.Exception ("Failed to start DAAP client", e);
            }

            var uia_service = ServiceManager.Get<InterfaceActionService> ();
            uia_service.GlobalActions.Add (
                new ActionEntry ("AddRemoteDaapServerAction", Stock.Add,
                    Catalog.GetString ("Add Remote DAAP Server"), null,
                    Catalog.GetString ("Add a new remote DAAP server"),
                    OnAddRemoteServer)
            );
            uia_service.UIManager.AddUiFromResource ("GlobalUI.xml");
        }
Esempio n. 8
0
        public void ThreadedInitialize()
        {
            source_map = new Dictionary<string, DaapSource> ();
            container = new DaapContainerSource ();

            try {
                // Now start looking for services.
                // We do this after creating the source because if we do it before
                // there's a race condition where we get a service before the source
                // is added.
                locator = new ServiceLocator ();
                locator.Found += OnServiceFound;
                locator.Removed += OnServiceRemoved;
                locator.ShowLocalServices = true;
                locator_started = DateTime.Now;
                locator.Start ();

                proxy_server = new DaapProxyWebServer ();
                proxy_server.Start ();
            } catch (Exception e) {
                Log.Error ("Failed to start DAAP client", e);
            }

            var uia_service = ServiceManager.Get<InterfaceActionService> ();
            if (uia_service != null) {
                ThreadAssist.ProxyToMain ( () => {
                    uia_service.GlobalActions.Add (
                        new ActionEntry ("AddRemoteDaapServerAction", Stock.Add,
                            Catalog.GetString ("Add Remote DAAP Server"), null,
                            Catalog.GetString ("Add a new remote DAAP server"),
                            OnAddRemoteServer)
                    );
                    actions_id = uia_service.UIManager.AddUiFromResource ("GlobalUI.xml");
                });

            }
        }