Esempio n. 1
0
        /// <summary>
        /// 确定添加订阅源
        /// </summary>
        async void ConfirmAdd()
        {
            try
            {
                NewFeeds.Add(CurrentFeed);
                await CurrentFeed.RefreshAsync();

                await NewFeeds.SaveAsync();

                Messenger.Default.Send <NotificationMessage>(new NotificationMessage("成功添加"), "AddSuccess");
            }
            catch (Exception ex)
            {
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 数据初始化
        /// </summary>
        async void Init()
        {
            FavoritesFeed = await FeedDataHandler.GetFavoritesAsync() ?? FavoritesFeed;

            if (string.IsNullOrWhiteSpace(FavoritesFeed.Name))
            {
                FavoritesFeed.Name = "收藏";
            }
            if (FavoritesFeed.Articles == null)
            {
                FavoritesFeed.Articles = new ObservableCollection <ArticleViewModel>();
            }

            NewFeeds.CollectionChanged += NewFeeds_CollectionChanged;
            NewFeeds.Clear();
            FeedDataHandler.GetFeedsAsync().ForEach(feed => NewFeeds.Add(feed));

            FavoritesFeed.Articles.CollectionChanged += Articles_CollectionChanged;
        }