Ejemplo n.º 1
0
        public string GetBundle(string configuration, string bundleName, params string[] extraParams)
        {
            var param = new[] { bundleName }.Concat(extraParams);
            int paramLen = param.Count();

            Bundle bundle = null;

            Config config;

            try
            {
                config = m_Persister.Load(configuration, m_ContentProcessor);
            }
            catch (Exception e)
            {
                throw new ConfigurationErrorsException(string.Format("Failed to load configuration '{0}': {1}", configuration, e.Message));
            }
            while (bundle == null && paramLen != 0)
            {
                string name = string.Join(".", param.Take(paramLen));
                bundle = config[name];
                paramLen--;
            }

            if (bundle == null)
            {
                throw new ConfigurationErrorsException("Bundle not found");
            }
            return(bundle.Content);
        }
        private Config getConfiguration(string configuration)
        {
            Config config;

            try
            {
                config = m_Persister.Load(configuration, m_ContentProcessor);
            }
            catch (Exception e)
            {
                throw new ConfigurationErrorsException(string.Format("Failed to load configuration '{0}'", configuration), e);
            }
            return(config);
        }
Ejemplo n.º 3
0
        public MainWindowViewModel(IFeedDownloader feedDownloader, IConfigurationPersister configurationPersister)
        {
            this.feedDownloader         = feedDownloader;
            this.configurationPersister = configurationPersister;

            feeds           = new ObservableCollection <Feed>();
            Feeds           = new ReadOnlyObservableCollection <Feed>(feeds);
            DownloadCommand = new RelayCommand((param) => Download(param as FeedItem), (param) => !(param as FeedItem)?.Downloading ?? false);

            Configuration = configurationPersister.Load();
            foreach (var feed in Configuration.Feeds)
            {
                feeds.Add(feed);
            }
        }