Exemple #1
0
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.
        /// This parameter is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            HardwareButtons.BackPressed += HardwareButtons_BackPressed;

            this.Post = (Post)e.Parameter;
        }
Exemple #2
0
        public async void ShowPost(Post post)
        {
            StatusBar.GetForCurrentView().ProgressIndicator.Text = "";
            await StatusBar.GetForCurrentView().ProgressIndicator.ShowAsync();

            tbPostTitle.Text = post.Title_Plain;
            tbAuthor.Text = "Автор " + post.Author.Name;
            tbDate.Text = post.Date;

            String html = post.Content;

            String output = Regex.Replace(html, "\\<div[^\\>]*\\>", "<div>");
            output = Regex.Replace(output, "\\<iframe[^\\>]*\\>", "<iframe>");
            output = Regex.Replace(output, "\\<button[^\\>]*\\>", "<button>");
            //output = Regex.Replace(output, "\\<a[^\\>]*\\>", "<a>");
            //Repairing links with img inside
            output = Regex.Replace(output, "\\<a[^\\>]*\\><img", "<img");
            output = Regex.Replace(output, "/></a>", "/>");
            //Removing img width and height (HtmlView improvement for poor connection)
            //output = Regex.Replace(output, "\\width=\"[0-9]*\\\"", " ");
            output = Regex.Replace(output,"height=\"[0-9]*\\\"", "");
            output = Regex.Replace(output, "width=\"[0-9]*\\\"", "");

            // Repearing <strong> tag
            output = output.Replace("<strong>\u00a0", " <strong>");
            output = output.Replace("\u00a0</strong>", "</strong> ");
            output = output.Replace("<strong> ", " <strong>");
            output = output.Replace(" </strong>", "</strong> ");
            // Remove video 'x' button
            output = output.Replace("<button>x</button>", "");
            //output = output.Replace("&amp;", "");

            if (!bLoadImages)
            {
                output = Regex.Replace(output, "\\<img[^\\>]*\\>", "");
            }
            // output = Regex.Replace(output, "\\<div\\>*\\<iframe\\>*\\</button\\>\\</div\\>", "</div>");

            hwPostContent.Html = output;

            await StatusBar.GetForCurrentView().ProgressIndicator.HideAsync();
        }