Exemple #1
0
        } // GetLastUserSelectedProvider

        private bool LoadServiceProviderList(bool fromCache)
        {
            try
            {
                ProviderDiscoveryRoot discovery;
                var baseIpAddress = AppUiConfiguration.Current.ContentProvider.Bootstrap.MulticastAddress;

                // can load from cache?
                discovery = null;
                if (fromCache)
                {
                    discovery = AppUiConfiguration.Current.Cache.LoadXml <ProviderDiscoveryRoot>("ProviderDiscovery", baseIpAddress);
                    if (discovery == null)
                    {
                        return(false);
                    } // if
                }     // if

                if (discovery == null)
                {
                    var basePort = AppUiConfiguration.Current.ContentProvider.Bootstrap.MulticastPort;

                    var downloader = new UiDvbStpSimpleDownloader()
                    {
                        Request = new UiDvbStpSimpleDownloadRequest()
                        {
                            PayloadId               = 0x01,
                            SegmentId               = null, // accept any segment
                            MulticastAddress        = IPAddress.Parse(baseIpAddress),
                            MulticastPort           = basePort,
                            Description             = Properties.DiscoveryTexts.SPObtainingList,
                            DescriptionParsing      = Properties.DiscoveryTexts.SPParsingList,
                            PayloadDataType         = typeof(ProviderDiscoveryRoot),
                            AllowXmlExtraWhitespace = false,
                            XmlNamespaceReplacer    = NamespaceUnification.Replacer,
                        },
                        TextUserCancelled     = Properties.DiscoveryTexts.UserCancelListRefresh,
                        TextDownloadException = Properties.DiscoveryTexts.SPListUnableRefresh,
                    };
                    downloader.Download(this);
                    if (!downloader.IsOk)
                    {
                        return(false);
                    }

                    discovery = downloader.Response.DeserializedPayloadData as ProviderDiscoveryRoot;
                    AppUiConfiguration.Current.Cache.SaveXml("ProviderDiscovery", baseIpAddress, downloader.Response.Version, discovery);
                } // if

                ProvidersDiscovery = new UiProviderDiscovery(discovery);
                FillServiceProviderList();

                return(true);
            }
            catch (Exception ex)
            {
                HandleException(new ExceptionEventData(Properties.DiscoveryTexts.SPListUnableRefresh, ex));
                return(false);
            } // try-catch
        }     // LoadServiceProviderList
Exemple #2
0
        } // Run

        private bool Init()
        {
            // load configuration
            var result = AppUiConfiguration.Load(null, Console.WriteLine);

            if (result.IsError)
            {
                Console.WriteLine(result.Message);
                return(false);
            } // if

            // get channels
            Console.WriteLine("Loading broadcast services");
            var providers = AppUiConfiguration.Current.Cache.LoadXml <ProviderDiscoveryRoot>("ProviderDiscovery", AppUiConfiguration.Current.ContentProvider.Bootstrap.MulticastAddress);

            ServiceProvider = UiProviderDiscovery.GetUiServiceProviderFromKey(providers, "dem_19.imagenio.es");

            var downloader = new UiBroadcastDiscoveryDownloader();

            BroadcastDiscovery = downloader.Download(null, ServiceProvider, null, true);

            ParentalGuidanceCodes = new Dictionary <string, string>();
            EpgServices           = new Dictionary <string, EpgService>();

            return(true);
        } // Init
Exemple #3
0
        }     // buttonProviderDetails_Click_Implementation

        #endregion

        public static UiServiceProvider GetLastUserSelectedProvider(string lastSelectedServiceProvider)
        {
            var lastSelectedProvider = lastSelectedServiceProvider;

            if (lastSelectedProvider == null)
            {
                return(null);
            }

            var baseIpAddress = AppUiConfiguration.Current.ContentProvider.Bootstrap.MulticastAddress;
            var discovery     = AppUiConfiguration.Current.Cache.LoadXml <ProviderDiscoveryRoot>("ProviderDiscovery", baseIpAddress);

            if (discovery == null)
            {
                return(null);
            }

            return(UiProviderDiscovery.GetUiServiceProviderFromKey(discovery, lastSelectedProvider));
        } // GetLastUserSelectedProvider