Ejemplo n.º 1
0
        /// <summary>
        /// The methods provided in this section are simply used to allow
        /// NavigationHelper to respond to the page's navigation methods.
        /// <para>
        /// Page specific logic should be placed in event handlers for the
        /// <see cref="NavigationHelper.LoadState"/>
        /// and <see cref="NavigationHelper.SaveState"/>.
        /// The navigation parameter is available in the LoadState method
        /// in addition to page state preserved during an earlier session.
        /// </para>
        /// </summary>
        /// <param name="e">Provides data for navigation methods and event
        /// handlers that cannot cancel the navigation request.</param>
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            this.navigationHelper.OnNavigatedTo(e);
            string commentsCount = string.Empty;
            var    pageFile      = string.Empty;

            if (!CNBlogs.DataHelper.DataModel.CNBlogSettings.Instance.NightModeTheme)
            {
                pageFile = "ms-appx-web:///HTML/news_day.html";
                this.wv_WebContent.DefaultBackgroundColor = Windows.UI.Colors.White;
            }
            else
            {
                pageFile = "ms-appx-web:///HTML/news_night.html";
                this.wv_WebContent.DefaultBackgroundColor = Windows.UI.Colors.Black;
            }

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

                this.wv_WebContent.Navigate(new Uri(pageFile));
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// The methods provided in this section are simply used to allow
        /// NavigationHelper to respond to the page's navigation methods.
        /// <para>
        /// Page specific logic should be placed in event handlers for the
        /// <see cref="NavigationHelper.LoadState"/>
        /// and <see cref="NavigationHelper.SaveState"/>.
        /// The navigation parameter is available in the LoadState method
        /// in addition to page state preserved during an earlier session.
        /// </para>
        /// </summary>
        /// <param name="e">Provides data for navigation methods and event
        /// handlers that cannot cancel the navigation request.</param>
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (e.NavigationMode == NavigationMode.New)
            {
                Logger.LogAgent.GetInstance().WriteLog(this.GetType().ToString());
            }

            this.navigationHelper.OnNavigatedTo(e);
            if (e.NavigationMode != NavigationMode.Back)
            {
                var pageFile = string.Empty;
                if (!CNBlogs.DataHelper.DataModel.CNBlogSettings.Instance.NightModeTheme)
                {
                    pageFile = "ms-appx-web:///HTML/news_day.html#width={0}&height={1}";
                    this.wv_WebContent.DefaultBackgroundColor = Windows.UI.Colors.White;
                }
                else
                {
                    pageFile = "ms-appx-web:///HTML/news_night.html#width={0}&height={1}";
                    this.wv_WebContent.DefaultBackgroundColor = Windows.UI.Colors.Black;
                }

                if (e.Parameter is News)
                {
                    this.news          = e.Parameter as News;
                    this.commentsCount = news.CommentsCount;
                    CNBlogs.DataHelper.CloudAPI.NewsContentDS ncDS = new DataHelper.CloudAPI.NewsContentDS(news.ID);
                    if (await ncDS.LoadRemoteData())
                    {
                        //this.wv_Post.NavigateToString(ncDS.News.Content);
                        // add title to news
                        content = "<h2 class='title'>" + this.news.Title + "</h2>" + ncDS.News.Content;
                    }
                    this.UpdateUI();
                    string width  = Window.Current.Bounds.Width.ToString();
                    string height = Window.Current.Bounds.Height.ToString();

                    this.wv_WebContent.Navigate(new Uri(string.Format(pageFile, width, height)));
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// The methods provided in this section are simply used to allow
        /// NavigationHelper to respond to the page's navigation methods.
        /// <para>
        /// Page specific logic should be placed in event handlers for the
        /// <see cref="NavigationHelper.LoadState"/>
        /// and <see cref="NavigationHelper.SaveState"/>.
        /// The navigation parameter is available in the LoadState method
        /// in addition to page state preserved during an earlier session.
        /// </para>
        /// </summary>
        /// <param name="e">Provides data for navigation methods and event
        /// handlers that cannot cancel the navigation request.</param>
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            this.navigationHelper.OnNavigatedTo(e);
            string commentsCount = string.Empty;
            var    pageFile      = string.Empty;

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

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

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

            UpdateUI(commentsCount);

            this.wv_WebContent.Navigate(new Uri(pageFile));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// The methods provided in this section are simply used to allow
        /// NavigationHelper to respond to the page's navigation methods.
        /// <para>
        /// Page specific logic should be placed in event handlers for the  
        /// <see cref="NavigationHelper.LoadState"/>
        /// and <see cref="NavigationHelper.SaveState"/>.
        /// The navigation parameter is available in the LoadState method 
        /// in addition to page state preserved during an earlier session.
        /// </para>
        /// </summary>
        /// <param name="e">Provides data for navigation methods and event
        /// handlers that cannot cancel the navigation request.</param>
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (e.NavigationMode == NavigationMode.New)
            {
                Logger.LogAgent.GetInstance().WriteLog(this.GetType().ToString());
            }

            this.navigationHelper.OnNavigatedTo(e);
            if (e.NavigationMode != NavigationMode.Back)
            {

                var pageFile = string.Empty;
                if (!CNBlogs.DataHelper.DataModel.CNBlogSettings.Instance.NightModeTheme)
                {
                    pageFile = "ms-appx-web:///HTML/news_day.html#width={0}&height={1}";
                    this.wv_WebContent.DefaultBackgroundColor = Windows.UI.Colors.White;
                }
                else
                {
                    pageFile = "ms-appx-web:///HTML/news_night.html#width={0}&height={1}";
                    this.wv_WebContent.DefaultBackgroundColor = Windows.UI.Colors.Black;
                }

                if (e.Parameter is News)
                {
                    this.news = e.Parameter as News;
                    this.commentsCount = news.CommentsCount;
                    CNBlogs.DataHelper.CloudAPI.NewsContentDS ncDS = new DataHelper.CloudAPI.NewsContentDS(news.ID);
                    if (await ncDS.LoadRemoteData())
                    {
                        //this.wv_Post.NavigateToString(ncDS.News.Content);
                        // add title to news
                        content = "<h2 class='title'>" + this.news.Title + "</h2>" + ncDS.News.Content;
                    }
                    this.UpdateUI();
                    string width = Window.Current.Bounds.Width.ToString();
                    string height = Window.Current.Bounds.Height.ToString();

                    this.wv_WebContent.Navigate(new Uri(string.Format(pageFile, width, height)));
                }
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// The methods provided in this section are simply used to allow
        /// NavigationHelper to respond to the page's navigation methods.
        /// <para>
        /// Page specific logic should be placed in event handlers for the  
        /// <see cref="NavigationHelper.LoadState"/>
        /// and <see cref="NavigationHelper.SaveState"/>.
        /// The navigation parameter is available in the LoadState method 
        /// in addition to page state preserved during an earlier session.
        /// </para>
        /// </summary>
        /// <param name="e">Provides data for navigation methods and event
        /// handlers that cannot cancel the navigation request.</param>
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            this.navigationHelper.OnNavigatedTo(e);
            string commentsCount = string.Empty;
            var pageFile = string.Empty;

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

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

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

            }

            UpdateUI(commentsCount);

            this.wv_WebContent.Navigate(new Uri(pageFile));
        }