Beispiel #1
0
        void AboutFlyout_Loaded(object sender, RoutedEventArgs e)
        {
            ContentWebView.Height = this.ActualHeight - 180;

            var loader = new Windows.ApplicationModel.Resources.ResourceLoader();

            string HTMLOpenTags  = loader.GetString("HTMLOpenTags");
            string HTMLCloseTags = loader.GetString("HTMLCloseTags");

            string contentString = string.Empty;

            if (this.DataContext != null)
            {
                ControlInfoDataItem item = this.DataContext as ControlInfoDataItem;
                if (item != null)
                {
                    contentString   = item.Content.ToString();
                    this.IconSource = new BitmapImage(new Uri(item.ImagePath));
                }
            }
            else
            {
                contentString = loader.GetString("helpFlyoutContent");
            }

            ContentWebView.NavigateToString(HTMLOpenTags + contentString + HTMLCloseTags);
        }
Beispiel #2
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            var NewsItem = (NewsList)e.Parameter;

            if (NewsItem.Content == "加载中...")
            {
                getContent(NewsItem.Articleid);
            }

            TitleTextBlock.Text = NewsItem.Title;
            //ContentTextBlock.Text = NewsItem.Content_all;

            if (NewsItem.Content_all != "")
            {
                JObject newsContentobj = JObject.Parse(NewsItem.Content_all);
                if (Int32.Parse(newsContentobj["state"].ToString()) == 200)
                {
                    ContentWebView.NavigateToString((JObject.Parse(newsContentobj["data"].ToString()))["content"].ToString());
                }
            }
            if (NewsItem.Read != "")
            {
                DateReadTextBlock.Text = "发布时间:" + NewsItem.Date + " 阅读人数:" + NewsItem.Read;
            }
            else
            {
                DateReadTextBlock.Text = "发布时间:" + NewsItem.Date;
            }
            UmengSDK.UmengAnalytics.TrackPageStart("NewsContentPage");
        }
Beispiel #3
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            //Uri uri = new Uri(((MyClass.Entry)(e.Parameter)).Link.Href);
            if (e.Parameter != null)
            {
                if ((e.Parameter) is Entry)
                {
                    entry = (Entry)(e.Parameter);
                    if (entry != null)
                    {
                        NewsBody newsBody = Function.Derserlializer <NewsBody>(await Function.GetNewsListStringAsync(new Uri("http://wcf.open.cnblogs.com/news/item/" + entry.Id)));
                        ContentWebView.NavigateToString(newsBody.content.Replace("<img", "<img style=\"max-width: 100%\""));
                    }
                }
                else if ((e.Parameter) is int)
                {
                    OneToTwoPage.Current.RightFrame.BackStack.Clear();
                }
            }


            if (OneToTwoPage.Current.RightFrame.CanGoBack)
            {
                SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
                SystemNavigationManager.GetForCurrentView().BackRequested += NewsContentPage_BackRequested;
            }
            else
            {
                SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed;
            }
        }
Beispiel #4
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            Debug.WriteLine("DetailPage OnNavigatedTo()");

            // Register this page as a share source
            _dataTransferManager = DataTransferManager.GetForCurrentView();

            _dataTransferManager.DataRequested += DataTransferManagerOnDataRequested;

            // Set the item to the one we received in the NavigateTo() call
            Item = e.Parameter as ReadingListDataItem;

            if (Item != null)
            {
                pageTitle.Text = Item.Title;

                Debug.WriteLine("Window height: {0}", Window.Current.Bounds.Height);

                var content = WrapHtml(Item.Title, Item.Content, Window.Current.Bounds.Height);

                try
                {
                    ContentWebView.NavigateToString(content);
                }
                catch (Exception)
                {
                    Debug.WriteLine("ContentWebView.NavigateToString exception!");
                }
            }
        }
Beispiel #5
0
        private void TermsConditionClick(object sender, RoutedEventArgs e)
        {
            var content = SettingsUtil.Instance.GetTermsAndConditions();

            HeadPanel.Visibility      = Visibility.Collapsed;
            ContentWebView.Visibility = Visibility.Visible;
            ContentWebView.NavigateToString(content);
        }
Beispiel #6
0
        private void AboutLexisNexisClick(object sender, RoutedEventArgs e)
        {
            var content = SettingsUtil.Instance.GetLexisNexisInfo();

            HeadPanel.Visibility      = Visibility.Collapsed;
            ContentWebView.Visibility = Visibility.Visible;
            ContentWebView.NavigateToString(content);
        }
Beispiel #7
0
        private async void getContent(string Articleid)
        {
            //List<KeyValuePair<String, String>> contentparamList = new List<KeyValuePair<String, String>>();
            //contentparamList.Add(new KeyValuePair<string, string>("id", ID));
            //string jwContent = await NetWork.getHttpWebRequest("api/jwNewsContent", contentparamList);
            //Debug.WriteLine("jwContent->" + jwContent);
            //if (jwContent != "")
            //{
            //    string JWContentText = jwContent.Replace("(\r?\n(\\s*\r?\n)+)", "\r\n");
            //    JObject jwContentobj = JObject.Parse(JWContentText);
            //    if (Int32.Parse(jwContentobj["status"].ToString()) == 200)
            //    {
            //        string JWitemContent = jwContentobj["data"]["content"].ToString();
            //        while (JWitemContent.StartsWith("\r\n "))
            //            JWitemContent = JWContentText.Substring(3);
            //        while (JWitemContent.StartsWith("\r\n"))
            //            JWitemContent = JWContentText.Substring(2);
            //        while (JWitemContent.StartsWith("\n\t"))
            //            JWitemContent = JWContentText.Substring(2);
            //        while (JWitemContent.StartsWith("\n"))
            //            JWitemContent = JWitemContent.Substring(1);
            //    }
            //    else
            //        ContentTextBlock.Text = "加载失败";
            //}



            List <KeyValuePair <String, String> > contentparamList = new List <KeyValuePair <String, String> >();

            contentparamList.Add(new KeyValuePair <string, string>("type", "jwzx"));
            contentparamList.Add(new KeyValuePair <string, string>("articleid", Articleid));
            string newsContent = await NetWork.getHttpWebRequest("cyxbsMobile/index.php/home/news/searchcontent", contentparamList);

            //Debug.WriteLine("newsContent->" + newsContent);
            if (newsContent != "")
            {
                JObject newsContentobj = JObject.Parse(newsContent);
                if (Int32.Parse(newsContentobj["state"].ToString()) == 200)
                {
                    string content = (JObject.Parse(newsContentobj["data"].ToString()))["content"].ToString();
                    ContentWebView.NavigateToString(content);
                }
            }
        }
        private async void getContent(string Articleid)
        {
            List <KeyValuePair <String, String> > contentparamList = new List <KeyValuePair <String, String> >();

            contentparamList.Add(new KeyValuePair <string, string>("type", "jwzx"));
            contentparamList.Add(new KeyValuePair <string, string>("articleid", Articleid));
            string newsContent = await NetWork.getHttpWebRequest("cyxbsMobile/index.php/home/news/searchcontent", contentparamList);

            //Debug.WriteLine("newsContent->" + newsContent);
            if (newsContent != "")
            {
                JObject newsContentobj = JObject.Parse(newsContent);
                if (Int32.Parse(newsContentobj["state"].ToString()) == 200)
                {
                    string content = (JObject.Parse(newsContentobj["data"].ToString()))["content"].ToString();
                    ContentWebView.NavigateToString(content);
                }
            }
        }
Beispiel #9
0
        private void DisplayCurrentItem()
        {
            SyndicationItem item = currentFeed.Items[currentItemIndex];

            // Display item number.
            IndexField.Text = String.Format(
                CultureInfo.InvariantCulture,
                "{0} of {1}",
                currentItemIndex + 1,
                currentFeed.Items.Count);

            // Display title.
            ItemTitleField.Text = item.Title != null ? item.Title.Text : "(no title)";

            // Display the main link.
            string link = string.Empty;

            if (item.Links.Count > 0)
            {
                link = item.Links[0].Uri.AbsoluteUri;
            }
            LinkField.Content = link;

            // Display item extensions.
            ExtensionsField.ItemsSource = item.ElementExtensions;

            // Display the body as HTML.
            string content = "(no content)";

            if (item.Content != null)
            {
                content = item.Content.Text;
            }
            else if (item.Summary != null)
            {
                content = item.Summary.Text;
            }
            ContentWebView.NavigateToString(content);
        }
        /// <summary>
        /// 在此页将要在 Frame 中显示时进行调用。
        /// </summary>
        /// <param name="e">描述如何访问此页的事件数据。
        /// 此参数通常用于配置页。</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            var NewsItem = (NewsList)e.Parameter;

            if (NewsItem.Content == "加载中...")
            {
                getContent(NewsItem.Articleid);
            }

            TitleTextBlock.Text = NewsItem.Title;
            //ContentTextBlock.Text = NewsItem.Content_all;

            if (NewsItem.Content_all != "")
            {
                JObject newsContentobj = JObject.Parse(NewsItem.Content_all);
                if (Int32.Parse(newsContentobj["state"].ToString()) == 200)
                {
                    ContentWebView.NavigateToString((JObject.Parse(newsContentobj["data"].ToString()))["content"].ToString());

                    JArray AnnexListArray = Utils.ReadJso(newsContentobj["data"].ToString(), "annex");
                    if (AnnexListArray != null)
                    {
                        ObservableCollection <NewsContentList.Annex> annexList = new ObservableCollection <NewsContentList.Annex>();
                        for (int i = 0; i < AnnexListArray.Count; i++)
                        {
                            NewsContentList.Annex annex = new NewsContentList.Annex();
                            annex.GetAttribute((JObject)AnnexListArray[i]);
                            if (annex.name != "")
                            {
                                Uri Anneximg;
                                if (annex.name.IndexOf(".zip") != -1)
                                {
                                    Anneximg = new Uri("ms-appx:///Assets/Annex_img/Annex_zip.png", UriKind.Absolute);
                                }
                                else if (annex.name.IndexOf(".rar") != -1)
                                {
                                    Anneximg = new Uri("ms-appx:///Assets/Annex_img/Annex_rar.png", UriKind.Absolute);
                                }
                                else if (annex.name.IndexOf(".pdf") != -1)
                                {
                                    Anneximg = new Uri("ms-appx:///Assets/Annex_img/Annex_pdf.png", UriKind.Absolute);
                                }
                                else if (annex.name.IndexOf(".doc") != -1 || annex.name.IndexOf(".docx") != -1)
                                {
                                    Anneximg = new Uri("ms-appx:///Assets/Annex_img/Annex_doc.png", UriKind.Absolute);
                                }
                                else if (annex.name.IndexOf(".xls") != -1 || annex.name.IndexOf(".xlsx") != -1)
                                {
                                    Anneximg = new Uri("ms-appx:///Assets/Annex_img/Annex_xls.png", UriKind.Absolute);
                                }
                                else if (annex.name.IndexOf(".ppt") != -1 || annex.name.IndexOf(".pptx") != -1)
                                {
                                    Anneximg = new Uri("ms-appx:///Assets/Annex_img/Annex_ppt.png", UriKind.Absolute);
                                }
                                else if (annex.name.IndexOf(".jpg") != -1 || annex.name.IndexOf(".png") != -1 || annex.name.IndexOf(".gif") != -1 || annex.name.IndexOf(".bmp") != -1 || annex.name.IndexOf(".jpeg") != -1)
                                {
                                    Anneximg = new Uri("ms-appx:///Assets/Annex_img/Annex_image.png", UriKind.Absolute);
                                }
                                else if (annex.name.IndexOf(".mp4") != -1 || annex.name.IndexOf(".rmvb") != -1 || annex.name.IndexOf(".avi") != -1)
                                {
                                    Anneximg = new Uri("ms-appx:///Assets/Annex_img/Annex_video.png", UriKind.Absolute);
                                }
                                else if (annex.name.IndexOf(".mp3") != -1)
                                {
                                    Anneximg = new Uri("ms-appx:///Assets/Annex_img/Annex_music.png", UriKind.Absolute);
                                }
                                else if (annex.name.IndexOf(".apk") != -1)
                                {
                                    Anneximg = new Uri("ms-appx:///Assets/Annex_img/Annex_apk.png", UriKind.Absolute);
                                }
                                else
                                {
                                    Anneximg = new Uri("ms-appx:///Assets/Annex_img/Annex_other.png", UriKind.Absolute);
                                }

                                annexList.Add(new NewsContentList.Annex {
                                    name = annex.name, address = annex.address, Anneximg = Anneximg
                                });
                                commandBar.Visibility = Visibility.Visible;
                            }
                            else
                            {
                                commandBar.Visibility = Visibility.Collapsed;
                                break;
                            }
                        }
                        AnnexListView.ItemsSource = annexList;
                    }
                    else
                    {
                        commandBar.Visibility = Visibility.Collapsed;
                    }
                }
            }
            if (NewsItem.Read != "")
            {
                DateReadTextBlock.Text = "发布时间:" + NewsItem.Date + " 阅读人数:" + NewsItem.Read;
            }
            else
            {
                DateReadTextBlock.Text = "发布时间:" + NewsItem.Date;
            }


            HardwareButtons.BackPressed += HardwareButtons_BackPressed;//注册重写后退按钮事件
            UmengSDK.UmengAnalytics.TrackPageStart("NewsContentPage");
        }