Esempio n. 1
0
        /// The methods provided in this section are simply used to allow
        /// NavigationHelper to respond to the page's navigation methods.
        ///
        /// Page specific logic should be placed in event handlers for the
        /// <see cref="GridCS.Common.NavigationHelper.LoadState"/>
        /// and <see cref="GridCS.Common.NavigationHelper.SaveState"/>.
        /// The navigation parameter is available in the LoadState method
        /// in addition to page state preserved during an earlier session.

        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            try
            {
                navigationHelper.OnNavigatedTo(e);

                if (e.NavigationMode == NavigationMode.New)
                {
                    Logger.LogAgent.GetInstance().WriteLog(this.GetType().ToString());
                }
                this.commentsCount = string.Empty;
                var pageFile = string.Empty;

                if (e.Parameter is News)
                {
                    this.news          = e.Parameter as News;
                    this.Title         = this.news.Title;
                    this.commentsCount = news.CommentsCount;
                    CNBlogs.DataHelper.CloudAPI.NewsContentDS ncDS = new DataHelper.CloudAPI.NewsContentDS(news.ID);
                    if (await ncDS.LoadRemoteData())
                    {
                        content = ncDS.News.Content;
                    }

                    pageFile = "ms-appx-web:///HTML/news_day.html";

                    this.commentDS = new CommentsDS(this.news.ID, "news");
                }
                else
                {
                    return;
                }

                this.DataContext = this;
                this.wv_Post.Navigate(new Uri(pageFile));
                this.commentDS.OnLoadMoreCompleted += commentDS_OnLoadMoreCompleted;

                this.lv_Comments.ItemsSource = commentDS;
                if (this.commentsCount.Trim('/') == "0")
                {
                    this.lv_Comments.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                    this.tb_Message.Visibility  = Windows.UI.Xaml.Visibility.Visible;
                }

                //Set Visual States
                this.SetPageVisualStatus(RenderSize.Width);
                this.SetTitleFont(pageTitle.Text.Length);
            }
            catch (Exception ex)
            {
                this.Title = ex.Message;
            }
        }
Esempio n. 2
0
        /// The methods provided in this section are simply used to allow
        /// NavigationHelper to respond to the page's navigation methods.
        ///
        /// Page specific logic should be placed in event handlers for the
        /// <see cref="GridCS.Common.NavigationHelper.LoadState"/>
        /// and <see cref="GridCS.Common.NavigationHelper.SaveState"/>.
        /// The navigation parameter is available in the LoadState method
        /// in addition to page state preserved during an earlier session.

        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            navigationHelper.OnNavigatedTo(e);

            string commentsCount = string.Empty;
            var    pageFile      = string.Empty;

            if (e.Parameter is Post)
            {
                this.post     = e.Parameter as Post;
                this.Title    = this.post.Title;
                this.Author   = post.Author;
                commentsCount = post.CommentsCount;
                CNBlogs.DataHelper.CloudAPI.PostContentDS pcDS = new DataHelper.CloudAPI.PostContentDS(post.ID);
                if (await pcDS.LoadRemoteData())
                {
                    content = pcDS.Content;
                }

                pageFile = "ms-appx-web:///HTML/post.html";
                currentBlogger.DataContext = this.post.Author;
                this.commentDS             = new CommentsDS(this.post.ID, "blog");
            }
            else if (e.Parameter is News)
            {
                this.news     = e.Parameter as News;
                this.Title    = this.news.Title;
                commentsCount = news.CommentsCount;
                CNBlogs.DataHelper.CloudAPI.NewsContentDS ncDS = new DataHelper.CloudAPI.NewsContentDS(news.ID);
                if (await ncDS.LoadRemoteData())
                {
                    content = ncDS.News.Content;
                }

                pageFile = "ms-appx-web:///HTML/news.html";

                this.commentDS = new CommentsDS(this.news.ID, "news");
            }
            this.DataContext = this;
            this.wv_Post.Navigate(new Uri(pageFile));
            this.lv_Comments.ItemsSource = commentDS;
        }
Esempio n. 3
0
        /// The methods provided in this section are simply used to allow
        /// NavigationHelper to respond to the page's navigation methods.
        /// 
        /// Page specific logic should be placed in event handlers for the  
        /// <see cref="GridCS.Common.NavigationHelper.LoadState"/>
        /// and <see cref="GridCS.Common.NavigationHelper.SaveState"/>.
        /// The navigation parameter is available in the LoadState method 
        /// in addition to page state preserved during an earlier session.

        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            try
            {
                navigationHelper.OnNavigatedTo(e);

                this.commentsCount = string.Empty;
                var pageFile = string.Empty;

                if (e.Parameter is Post)
                {
                    this.post = e.Parameter as Post;
                    this.Title = this.post.Title;
                    this.Author = post.Author;
                    this.commentsCount = post.CommentsCount;
                    CNBlogs.DataHelper.CloudAPI.PostContentDS pcDS = new DataHelper.CloudAPI.PostContentDS(post.ID);
                    if (await pcDS.LoadRemoteData())
                    {
                        content = pcDS.Content;
                    }

                    pageFile = "ms-appx-web:///HTML/post_day.html";
                    currentBlogger.DataContext = this.post.Author;
                    this.commentDS = new CommentsDS(this.post.ID, "blog");

                    //set read
                    this.SetNewStatus(this.post, PostStatus.Read, true);
                }
                else if (e.Parameter is News)
                {
                    this.news = e.Parameter as News;
                    this.Title = this.news.Title;
                    this.commentsCount = news.CommentsCount;
                    CNBlogs.DataHelper.CloudAPI.NewsContentDS ncDS = new DataHelper.CloudAPI.NewsContentDS(news.ID);
                    if (await ncDS.LoadRemoteData())
                    {
                        content = ncDS.News.Content;
                    }

                    pageFile = "ms-appx-web:///HTML/news_day.html";

                    this.commentDS = new CommentsDS(this.news.ID, "news");
                    //CNBlogs.DataHelper.DataModel.CNBlogSettings.Instance.SetBlogAsRead(this.news.ID);
                }
                else
                {
                    return;
                }
                this.DataContext = this;
                this.wv_Post.Navigate(new Uri(pageFile));
                this.commentDS.OnLoadMoreCompleted += commentDS_OnLoadMoreCompleted;

                this.lv_Comments.ItemsSource = commentDS;
                if (this.commentsCount == "0")
                {
                    this.lv_Comments.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                    this.tb_Message.Visibility = Windows.UI.Xaml.Visibility.Visible;
                }
            }
            catch (Exception ex)
            {
                this.Title = ex.Message;
            }
        }
        /// The methods provided in this section are simply used to allow
        /// NavigationHelper to respond to the page's navigation methods.
        /// 
        /// Page specific logic should be placed in event handlers for the  
        /// <see cref="GridCS.Common.NavigationHelper.LoadState"/>
        /// and <see cref="GridCS.Common.NavigationHelper.SaveState"/>.
        /// The navigation parameter is available in the LoadState method 
        /// in addition to page state preserved during an earlier session.

        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            try
            {
                navigationHelper.OnNavigatedTo(e);

                if (e.NavigationMode == NavigationMode.New)
                {
                    Logger.LogAgent.GetInstance().WriteLog(this.GetType().ToString());
                }
                this.commentsCount = string.Empty;
                var pageFile = string.Empty;

                if (e.Parameter is News)
                {
                    this.news = e.Parameter as News;
                    this.Title = this.news.Title;
                    this.commentsCount = news.CommentsCount;
                    CNBlogs.DataHelper.CloudAPI.NewsContentDS ncDS = new DataHelper.CloudAPI.NewsContentDS(news.ID);
                    if (await ncDS.LoadRemoteData())
                    {
                        content = ncDS.News.Content;
                    }

                    pageFile = "ms-appx-web:///HTML/news_day.html";

                    this.commentDS = new CommentsDS(this.news.ID, "news");
                }
                else
                {
                    return;
                }

                this.DataContext = this;
                this.wv_Post.Navigate(new Uri(pageFile));
                this.commentDS.OnLoadMoreCompleted += commentDS_OnLoadMoreCompleted;

                this.lv_Comments.ItemsSource = commentDS;
                if (this.commentsCount.Trim('/') == "0")
                {
                    this.lv_Comments.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                    this.tb_Message.Visibility = Windows.UI.Xaml.Visibility.Visible;
                }

                //Set Visual States
                this.SetPageVisualStatus(RenderSize.Width);
                this.SetTitleFont(pageTitle.Text.Length);
            }
            catch (Exception ex)
            {
                this.Title = ex.Message;
            }
        }
Esempio n. 5
0
        /// The methods provided in this section are simply used to allow
        /// NavigationHelper to respond to the page's navigation methods.
        ///
        /// Page specific logic should be placed in event handlers for the
        /// <see cref="GridCS.Common.NavigationHelper.LoadState"/>
        /// and <see cref="GridCS.Common.NavigationHelper.SaveState"/>.
        /// The navigation parameter is available in the LoadState method
        /// in addition to page state preserved during an earlier session.

        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            try
            {
                navigationHelper.OnNavigatedTo(e);

                this.commentsCount = string.Empty;
                var pageFile = string.Empty;

                if (e.Parameter is Post)
                {
                    this.post          = e.Parameter as Post;
                    this.Title         = this.post.Title;
                    this.Author        = post.Author;
                    this.commentsCount = post.CommentsCount;
                    CNBlogs.DataHelper.CloudAPI.PostContentDS pcDS = new DataHelper.CloudAPI.PostContentDS(post.ID);
                    if (await pcDS.LoadRemoteData())
                    {
                        content = pcDS.Content;
                    }

                    pageFile = "ms-appx-web:///HTML/post_day.html";
                    currentBlogger.DataContext = this.post.Author;
                    this.commentDS             = new CommentsDS(this.post.ID, "blog");

                    //set read
                    this.SetNewStatus(this.post, PostStatus.Read, true);
                }
                else if (e.Parameter is News)
                {
                    this.news          = e.Parameter as News;
                    this.Title         = this.news.Title;
                    this.commentsCount = news.CommentsCount;
                    CNBlogs.DataHelper.CloudAPI.NewsContentDS ncDS = new DataHelper.CloudAPI.NewsContentDS(news.ID);
                    if (await ncDS.LoadRemoteData())
                    {
                        content = ncDS.News.Content;
                    }

                    pageFile = "ms-appx-web:///HTML/news_day.html";

                    this.commentDS = new CommentsDS(this.news.ID, "news");
                    //CNBlogs.DataHelper.DataModel.CNBlogSettings.Instance.SetBlogAsRead(this.news.ID);
                }
                else
                {
                    return;
                }
                this.DataContext = this;
                this.wv_Post.Navigate(new Uri(pageFile));
                this.commentDS.OnLoadMoreCompleted += commentDS_OnLoadMoreCompleted;

                this.lv_Comments.ItemsSource = commentDS;
                if (this.commentsCount == "0")
                {
                    this.lv_Comments.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                    this.tb_Message.Visibility  = Windows.UI.Xaml.Visibility.Visible;
                }
            }
            catch (Exception ex)
            {
                this.Title = ex.Message;
            }
        }