public System.IO.Stream Data(string args)
        {
            var    dataUri    = Convert.FromBase64String(args);
            var    requestUrl = Encoding.UTF8.GetString(dataUri);
            string textContent;

            try
            {
                var reader  = new ReadSharp.Reader();
                var article = reader.Read(new Uri(requestUrl)).Result;
                WebOperationContext.Current.OutgoingResponse.ContentType = "text/html; charset=utf-8";
                textContent = string.Format(@"<!DOCTYPE html>
                                    <html lang='en'>
                                    <head>
                                        <meta charset='utf-8'>
                                        <title>{0}</title>
                                    </head>
                                    <body>{1}</body>
                                    </html>", article.Title, article.Content);
            }
            catch (ReadSharp.ReadException exc)
            {
                textContent = exc.ToString();
            }

            var memStream = new MemoryStream();
            var byteArr   = Encoding.UTF8.GetBytes(textContent);

            memStream.Write(byteArr, 0, byteArr.Length);
            memStream.Seek(0, SeekOrigin.Begin);
            return(memStream);
        }
Example #2
0
        private async void ReadingMode_Tapped(object sender, TappedRoutedEventArgs e)
        {
            var reader  = new ReadSharp.Reader();
            var article = await reader.Read(new Uri(m_base.Source.Url));

            m_webView.NavigateToString(article.Content);
        }
Example #3
0
        private async void ReaderSharpButton_Click(object sender, RoutedEventArgs e)
        {
            var url = UrlBox.Text;

            ReadSharp.Reader reader = new ReadSharp.Reader();
            try
            {
                var readerSharpArticle = await reader.Read(new Uri(url));

                Html = readerSharpArticle.Content;
            }
            catch (UriFormatException exception)
            {
                System.Diagnostics.Debug.WriteLine(exception.Message);
            }
            CodeBlock.Code = Html;
            //Convert(Html);
            //Invoke(() => { ShowHtml(); });
            Bindings.Update();
        }