Exemplo n.º 1
0
 public ArticleViewModel()
 {
     Bookmark= new Bookmark();
     DataStorage = new DataStorage();
 }
Exemplo n.º 2
0
        public MainViewModel()
        {
            ApiBaseUrl = "";
            ConsumerKey = "";
            ConsumerSecret = "";

            ProgressVisible = false;
            DataStorage = new DataStorage();
            BookmarkList = new BookmarkList();

            ReadabilityClient = new ReadabilityApi.ReadabilityClient(ApiBaseUrl, ConsumerKey, ConsumerSecret);

            Observable.Buffer(Observable.FromEventPattern(this, "ReadingListUpdated").Throttle(TimeSpan.FromSeconds(1)), 1)
                .Subscribe(e =>
                {
                    ShellTile tile = ShellTile.ActiveTiles.First();
                    if (tile != null && ReadingList.Count > 0) //Do nothing if there's no tile pinned or there are no items in the list.
                    {
                        var firstArticleInReadingList = ReadingList.First().Article;

                        IconicTileData TileData = new IconicTileData()
                        {
                            Title = "Now Readable",
                            Count = ReadingListCount,
                            WideContent1 = firstArticleInReadingList.Title,
                            WideContent2 = firstArticleInReadingList.Excerpt.Substring(0, 100),
                            WideContent3 = firstArticleInReadingList.Author,
                            SmallIconImage = new Uri("Assets/Tiles/SmallIconImage.png", UriKind.Relative),
                            IconImage = new Uri("Assets/Tiles/IconImage.png", UriKind.Relative),
                            BackgroundColor = System.Windows.Media.Colors.Red
                        };

                        tile.Update(TileData);
                    }
                });
        }