示例#1
0
        public MainDataModel() : base(false, false)
        {
            this.Title = "Main Menu";
            this.UniqueID = "root";

            this.articles = new ArticleDataGroup();
            this.articles.Title = "Front Page";
            this.articles.Subtitle = "Your awful news feed.";
            this.articles.Group = this;
            this.articles.DataType = DATATYPE_MENU;
            this.Items.Add(articles);

            this.bookmarks = new BookmarkDataGroup(new BookmarksFeed());
            this.bookmarks.Title = "Bookmarks";
            this.bookmarks.Subtitle = "Threads you've bookmarked go here.";
            this.bookmarks.DataType = DATATYPE_MENU;
            this.bookmarks.Group = this;
            this.Items.Add(bookmarks);

            this.forums = new ForumsIndexGroup(new ForumsIndexFeed(StorageModelFactory.GetStorageModel()), pinned);
            this.forums.Title = "Forums Index";
            this.forums.Subtitle = "The Something Awful Forums.";
            this.forums.DataType = DATATYPE_MENU;
            this.forums.Group = this;
            
            this.pinned = this.forums.Pinned;
            this.pinned.Title = "Favorites";
            this.pinned.Subtitle = "Quick access to your favorite forums.";
            this.pinned.DataType = DATATYPE_MENU;
            this.pinned.Group = this;
            
            this.Items.Add(pinned);
            this.Items.Add(forums);
            this.ItemsSource = this.Items;
        }
示例#2
0
        protected override async Task<IWebViewModel<string>> CreateWebViewModelAsync(NavigationEventArgs e)
        {
            ArticleDataItem selected = null;
            if (NavigationContext.QueryString.ContainsKey("id"))
            {
                if (mainDataModel.Articles.Items.Count == 0)
                    await mainDataModel.Articles.OnSelectedAsync(this, this.progress);

                selected = mainDataModel.GetArticleDataByID(NavigationContext.QueryString["id"]); 
                this.viewmodel = selected;
                this.group = this.viewmodel.Group as ArticleDataGroup;
            }

            return selected;
        }