示例#1
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);
        }
示例#2
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");
                });
            }
        }
        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");
        }
示例#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");
                });

            }
        }