예제 #1
0
        /// <summary>
        /// Builds the name of the subscription (file name).
        /// </summary>
        /// <param name="id">The id.</param>
        /// <param name="type">The type.</param>
        /// <returns></returns>
        public static string BuildSubscriptionName(int id, FeedSourceType type)
        {
            //TODO: check name for invalid file name chars
            string path = FeedSource.DefaultConfiguration.UserApplicationDataPath;

            return(Path.Combine(path, String.Format("{0}.{1}.subscription", type, id)));
        }
예제 #2
0
        public SynchronizeFeedsWizard(FeedSourceType selectedFeedSource)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            this.Icon = Properties.Resources.Add;

            // form location management:
            _windowSerializer = new WindowSerializer(this);
            _windowSerializer.SaveOnlyLocation  = true;
            _windowSerializer.SaveNoWindowState = true;

            // to get notified, if the inet connection state changes:
            _internetService = IoC.Resolve <IInternetService>();
            if (_internetService != null)
            {
                _internetService.InternetConnectionStateChange += OnInternetServiceInternetConnectionStateChange;
                //radioFacebookReview.Enabled = _internetService.InternetAccessAllowed && !_internetService.InternetConnectionOffline;
            }

            this.wizard.SelectedPage = this.pageStartImport;

            if (selectedFeedSource != FeedSourceType.DirectAccess && selectedFeedSource != FeedSourceType.Unknown)
            {
                this.SelectedFeedSource = selectedFeedSource;
            }
        }
예제 #3
0
        // IFeedSource<T>
        public FeedWriterNode(IFeedDefinition <T> feed, FeedSourceType sourceType, Type modelType)
        {
            _feed          = feed;
            FeedSourceType = sourceType == Atom.FeedSourceType.direct
                                 ? typeof(DirectFeedSource <,>).MakeGenericType(modelType, typeof(T))
                                 : typeof(EnumerableFeedSource <,>).MakeGenericType(modelType, typeof(T));

            InputType = modelType;
        }
예제 #4
0
        /// <summary>
        /// Adds a new source with the specified name and properties.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="type">The type.</param>
        /// <param name="properties">The properties.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">If name is null</exception>
        /// <exception cref="ArgumentOutOfRangeException">If name is empty</exception>
        /// <exception cref="InvalidOperationException">If source with provided name yet exists</exception>
        public FeedSourceEntry Add(string name, FeedSourceType type, IDictionary properties)
        {
            name.ExceptionIfNullOrEmpty("name");

            if (Contains(name))
            {
                throw new InvalidOperationException("Entry with name '" + name + "' already exists");
            }

            int        id     = UniqueKey;
            FeedSource source = FeedSource.CreateFeedSource(id, type,
                                                            CreateSubscriptionLocation(id, type, properties));
            FeedSourceEntry fse = new FeedSourceEntry(id, source, name, _feedSources.Count);

            //fse.Properties =
            _feedSources.Add(fse.ID, fse);
            return(fse);
        }
예제 #5
0
        static SubscriptionLocation CreateSubscriptionLocation(int id, FeedSourceType type, IDictionary properties)
        {
            switch (type)
            {
            case FeedSourceType.DirectAccess:
                return(new SubscriptionLocation(BuildSubscriptionName(id, type)));

            //case FeedSourceType.Google:
            //	return new SubscriptionLocation(BuildSubscriptionName(id, type),
            //		BuildCredentials(properties));
            //case FeedSourceType.NewsGator:
            //	return new SubscriptionLocation(BuildSubscriptionName(id, type),
            //		BuildCredentials(properties));
            case FeedSourceType.WindowsRSS:
                return(new SubscriptionLocation(BuildSubscriptionName(id, type)));

            //case FeedSourceType.Facebook:
            //	return new SubscriptionLocation(BuildSubscriptionName(id, type), BuildCredentials(properties));
            default:
                throw new InvalidOperationException("FeedSourceType not supported:" + type);
            }
        }
예제 #6
0
 public FeedSource(string url, FeedSourceType type)
 {
     Url  = url;
     Type = type;
 }