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); }
void ReleaseDesignerOutlets() { if (AboutTitle != null) { AboutTitle.Dispose(); AboutTitle = null; } if (ContentTextView != null) { ContentTextView.Dispose(); ContentTextView = null; } if (ContentWebView != null) { ContentWebView.Dispose(); ContentWebView = null; } if (LastSyncTime != null) { LastSyncTime.Dispose(); LastSyncTime = null; } }
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"); }
private void Button_Click_1(object sender, RoutedEventArgs e) { var contentUri = ContentWebView.BuildLocalStreamUri("WebContent", "SecondaryPage.html"); var contentResolver = new WebContentResolver(); ContentWebView.NavigateToLocalStreamUri(contentUri, contentResolver); }
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; } }
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!"); } } }
void ReleaseDesignerOutlets() { if (ContentMenu != null) { ContentMenu.Dispose(); ContentMenu = null; } if (ContentWebView != null) { ContentWebView.Dispose(); ContentWebView = null; } if (CustomView != null) { CustomView.Dispose(); CustomView = null; } if (InfoLabel != null) { InfoLabel.Dispose(); InfoLabel = null; } }
private void AboutLexisNexisClick(object sender, RoutedEventArgs e) { var content = SettingsUtil.Instance.GetLexisNexisInfo(); HeadPanel.Visibility = Visibility.Collapsed; ContentWebView.Visibility = Visibility.Visible; ContentWebView.NavigateToString(content); }
private void TermsConditionClick(object sender, RoutedEventArgs e) { var content = SettingsUtil.Instance.GetTermsAndConditions(); HeadPanel.Visibility = Visibility.Collapsed; ContentWebView.Visibility = Visibility.Visible; ContentWebView.NavigateToString(content); }
private void Button_Click(object sender, RoutedEventArgs e) { ErrorBlock.Visibility = Visibility.Collapsed; var contentUri = ContentWebView.BuildLocalStreamUri("WebContent", "PrimaryPage.html"); var contentResolver = new WebContentResolver(); ContentWebView.NavigateToLocalStreamUri(contentUri, contentResolver); }
private void JSChangeFontSize() { string jsString = string.Format("document.body.style.fontSize={0}", bodyFontSize + 5); ContentWebView.StringByEvaluatingJavaScriptFromString(jsString); //NSObject[] objectss = new NSObject[] {new NSString(bodyFontSize.ToString())}; //CallJs ("setBodyFontSize", objectss); }
private async void ContentWebView_OnFocused(object sender, FocusEventArgs e) { string heightString = await ContentWebView.EvaluateJavaScriptAsync("getHeight()"); bool heightParsed = double.TryParse(heightString, out _webViewHeight); if (heightParsed) { ContentWebView.HeightRequest = _webViewHeight + 25.0; } }
private async void ContentWebView_OnNavigating(object sender, WebNavigatingEventArgs e) { e.Cancel = true; string heightString = await ContentWebView.EvaluateJavaScriptAsync("getHeight()"); bool heightParsed = double.TryParse(heightString, out _webViewHeight); if (heightParsed) { ContentWebView.HeightRequest = _webViewHeight + 25.0; } }
void EditAnnotate(NSObject sender) { var element = (DomHtmlElement)ContentWebView.MainFrame.DomDocument.DocumentElement; string htmlString = element.OuterHTML; //string htmlText = element.OuterText; //plainText:{1} //string range = ContentWebView.SelectedDomRange.Text; //Console.WriteLine ("htmlText:{0}", htmlString); string range = ContentWebView.SelectedDomRange.Text; string markupString = string.Format("<span style='color: red; font-style: italic'>{0}</span>", range); ContentWebView.ReplaceSelectionWithMarkupString(markupString); }
private async void EditButton_OnClicked(object sender, EventArgs e) { if (_viewModel.EditMode) { _viewModel.EditMode = false; _viewModel.IsBusy = true; _viewModel.IsSaving = true; DateTime noteDate = new DateTime(_viewModel.DateYear, _viewModel.DateMonth, _viewModel.DateDay, _viewModel.DateHours, _viewModel.DateMinutes, 0); _viewModel.CurrentNote.CreatedDate = noteDate; _viewModel.CurrentNote.Title = _viewModel.NoteTitle; string noteContent = await ContentWebView.EvaluateJavaScriptAsync("getContent()"); noteContent = noteContent.Replace(@"\u003C", "<"); // Todo: Proper string encoding/decoding. _viewModel.CurrentNote.Content = noteContent; _viewModel.CurrentNote.Category = CategoryEntry.Text; _viewModel.CurrentNote.AccessLevel = _viewModel.AccessLevel; // Save changes. Note resultNote = await ProgenyService.UpdateNote(_viewModel.CurrentNote); _viewModel.IsBusy = false; _viewModel.IsSaving = false; EditButton.Text = IconFont.CalendarEdit; if (resultNote != null) // Todo: Error message if update fails. { MessageLabel.Text = "Note Updated"; // Todo: Translate MessageLabel.BackgroundColor = Color.DarkGreen; MessageLabel.IsVisible = true; await Reload(); } } else { EditButton.Text = IconFont.ContentSave; HtmlWebViewSource htmlSource = new HtmlWebViewSource(); // htmlSource.BaseUrl = DependencyService.Get<IBaseUrl>().Get(); htmlSource.Html = DependencyService.Get <IBaseUrl>().GetQuillHtml().Replace("!!Content!!", _viewModel.Content); ContentWebView.Source = htmlSource; _viewModel.EditMode = true; _viewModel.CategoryAutoSuggestList = await ProgenyService.GetCategoryAutoSuggestList(_viewModel.CurrentNote.ProgenyId, 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); } } }
void LegalDefine(NSObject sender) { DomRange range = ContentWebView.SelectedDomRange; string selectedText = range.Text; //ContentWebView.Editable = true; ContentWebView.ReplaceSelectionWithMarkupString("this"); //ContentWebView.Editable = false; // NSString *markupString = [NSString stringWithFormat: // @"<span style='color: red; font-style: italic'>%@</span>", // @”SomeString”]; // [webView replaceSelectionWithMarkupString:markupString]; this.Invoke(() => { var popover = new NSPopover(); popover.Behavior = NSPopoverBehavior.Transient; popover.ContentViewController = new LegalDefinePopViewController(selectedText, this.TitleCountryCode); CGRect rect = new CGRect(menuLocation.X, menuLocation.Y - 60, 5, 5); popover.Show(rect, ContentWebView, NSRectEdge.MinYEdge); }, 0.0f); }
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); }
public async override void ViewDidLoad() { base.ViewDidLoad(); AppDisplayUtil.Instance.contentVC = this; GotoBarButton.Hidden = true; PageNumLabel.Hidden = true; NSLayoutConstraint leadingContraint = NSLayoutConstraint.Create(ContentWebView, NSLayoutAttribute.Leading, NSLayoutRelation.GreaterThanOrEqual, View, NSLayoutAttribute.Leading, 1, 0); leadingContraint.Priority = 750; NSLayoutConstraint trailingContraint = NSLayoutConstraint.Create(ContentWebView, NSLayoutAttribute.Trailing, NSLayoutRelation.GreaterThanOrEqual, View, NSLayoutAttribute.Trailing, 1, 0); trailingContraint.Priority = 750; NSLayoutConstraint widthContraint = NSLayoutConstraint.Create(ContentWebView, NSLayoutAttribute.Width, NSLayoutRelation.LessThanOrEqual, View, NSLayoutAttribute.Width, 0, 703); widthContraint.Priority = 1000; View.AddConstraints(new NSLayoutConstraint[] { leadingContraint, trailingContraint, widthContraint, NSLayoutConstraint.Create(ContentWebView, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, View, NSLayoutAttribute.CenterX, 1, 0), //center X NSLayoutConstraint.Create(ContentWebView, NSLayoutAttribute.Top, NSLayoutRelation.Equal, View, NSLayoutAttribute.Top, 1, 45), //top 45 NSLayoutConstraint.Create(ContentWebView, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, View, NSLayoutAttribute.Bottom, 1, 0), //bottom 0 }); View.TranslatesAutoresizingMaskIntoConstraints = false; ContentWebView.TranslatesAutoresizingMaskIntoConstraints = false; IndexNavigationItem = new UINavigationItem(); IndexNavigationItem.LeftBarButtonItem = new UIBarButtonItem("A", UIBarButtonItemStyle.Plain, null); IndexNavigationItem.LeftBarButtonItem.SetTitlePositionAdjustment(new UIOffset(20, 0), UIBarMetrics.Default); ContentNavigationItem = new UINavigationItem(); UIBarButtonItem spaceBarButtonItem = new UIBarButtonItem("", UIBarButtonItemStyle.Plain, null); UIBarButtonItem forwardBarButtonItem = new UIBarButtonItem(new UIImage("Images/Navigation/GrayForwardArrow.png"), UIBarButtonItemStyle.Plain, delegate { NavigateForward(); }); forwardBarButtonItem.Enabled = false; UIBarButtonItem backwardBarButtonItem = new UIBarButtonItem(new UIImage("Images/Navigation/RedBackArrow.png"), UIBarButtonItemStyle.Plain, delegate { NavigateBackward(); }); backwardBarButtonItem.Enabled = false; ContentNavigationItem.LeftBarButtonItems = new UIBarButtonItem[] { spaceBarButtonItem, backwardBarButtonItem, forwardBarButtonItem }; ContentNavigationBar.PushNavigationItem(ContentNavigationItem, false); AppDataUtil.Instance.AddOpenedContentObserver(this); //Set current instance as the observer of subject OpendPublication to get notification when opend content changed if (await PageSearchUtil.Instance.IsPBO(AppDataUtil.Instance.GetCurrentPublication().BookId)) { this.JudgePBOBook("YES"); } NSNotificationCenter.DefaultCenter.AddObserver(new NSString("JudgePBOBook"), delegate(NSNotification obj) { if (obj.UserInfo != null) { string boolStr = obj.UserInfo.ObjectForKey(new NSString("PBOBook")).ToString(); this.JudgePBOBook(boolStr); } }); NSNotificationCenter.DefaultCenter.AddObserver(new NSString("ExecuteJS"), delegate(NSNotification obj) { if (obj.UserInfo != null) { string jsStr = obj.UserInfo.ObjectForKey(new NSString("jsStr")).ToString(); ContentWebView.EvaluateJavascript(jsStr); } }); }
void ReleaseDesignerOutlets() { if (Actor_Name != null) { Actor_Name.Dispose(); Actor_Name = null; } if (Actor_NameHeight != null) { Actor_NameHeight.Dispose(); Actor_NameHeight = null; } if (ActorImage != null) { ActorImage.Dispose(); ActorImage = null; } if (BackgroundContentFriendJoined != null) { BackgroundContentFriendJoined.Dispose(); BackgroundContentFriendJoined = null; } if (BackgroundProductSold != null) { BackgroundProductSold.Dispose(); BackgroundProductSold = null; } if (btn_OtherUsers != null) { btn_OtherUsers.Dispose(); btn_OtherUsers = null; } if (btnDotsTop != null) { btnDotsTop.Dispose(); btnDotsTop = null; } if (btnOpenInvitedProfile != null) { btnOpenInvitedProfile.Dispose(); btnOpenInvitedProfile = null; } if (ButtonFacebook != null) { ButtonFacebook.Dispose(); ButtonFacebook = null; } if (ButtonInviteFriends != null) { ButtonInviteFriends.Dispose(); ButtonInviteFriends = null; } if (ButtonProductSold != null) { ButtonProductSold.Dispose(); ButtonProductSold = null; } if (ButtonRewardClaimed != null) { ButtonRewardClaimed.Dispose(); ButtonRewardClaimed = null; } if (ButtonTwitter != null) { ButtonTwitter.Dispose(); ButtonTwitter = null; } if (CollectionUserView != null) { CollectionUserView.Dispose(); CollectionUserView = null; } if (CommentButton != null) { CommentButton.Dispose(); CommentButton = null; } if (CommentsText != null) { CommentsText.Dispose(); CommentsText = null; } if (ContectRewardClaimed != null) { ContectRewardClaimed.Dispose(); ContectRewardClaimed = null; } if (ContectRewardClaimedAspectRatio != null) { ContectRewardClaimedAspectRatio.Dispose(); ContectRewardClaimedAspectRatio = null; } if (ContectRewardClaimedRightBackground != null) { ContectRewardClaimedRightBackground.Dispose(); ContectRewardClaimedRightBackground = null; } if (ContectRewardClaimedTitle != null) { ContectRewardClaimedTitle.Dispose(); ContectRewardClaimedTitle = null; } if (ContentCollectionAvatarView != null) { ContentCollectionAvatarView.Dispose(); ContentCollectionAvatarView = null; } if (ContentCollectionAvatarViewAspectRatio != null) { ContentCollectionAvatarViewAspectRatio.Dispose(); ContentCollectionAvatarViewAspectRatio = null; } if (ContentCollectionCheckInView != null) { ContentCollectionCheckInView.Dispose(); ContentCollectionCheckInView = null; } if (ContentCollectionCheckInViewAspectRatio != null) { ContentCollectionCheckInViewAspectRatio.Dispose(); ContentCollectionCheckInViewAspectRatio = null; } if (ContentFriendJoined != null) { ContentFriendJoined.Dispose(); ContentFriendJoined = null; } if (ContentFriendJoinedAspectRatio != null) { ContentFriendJoinedAspectRatio.Dispose(); ContentFriendJoinedAspectRatio = null; } if (ContentFriendJoinedBackground != null) { ContentFriendJoinedBackground.Dispose(); ContentFriendJoinedBackground = null; } if (ContentFriendJoinedPhoto != null) { ContentFriendJoinedPhoto.Dispose(); ContentFriendJoinedPhoto = null; } if (ContentFriendJoinedUserName != null) { ContentFriendJoinedUserName.Dispose(); ContentFriendJoinedUserName = null; } if (ContentHeaderView != null) { ContentHeaderView.Dispose(); ContentHeaderView = null; } if (ContentImage != null) { ContentImage.Dispose(); ContentImage = null; } if (ContentImageAspectRatio != null) { ContentImageAspectRatio.Dispose(); ContentImageAspectRatio = null; } if (ContentImageTextCaption != null) { ContentImageTextCaption.Dispose(); ContentImageTextCaption = null; } if (ContentMap != null) { ContentMap.Dispose(); ContentMap = null; } if (ContentMapAspectRatio != null) { ContentMapAspectRatio.Dispose(); ContentMapAspectRatio = null; } if (ContentMapView != null) { ContentMapView.Dispose(); ContentMapView = null; } if (ContentProductSold != null) { ContentProductSold.Dispose(); ContentProductSold = null; } if (ContentProductSoldAspectRatio != null) { ContentProductSoldAspectRatio.Dispose(); ContentProductSoldAspectRatio = null; } if (ContentProductSoldTextView != null) { ContentProductSoldTextView.Dispose(); ContentProductSoldTextView = null; } if (ContentShare != null) { ContentShare.Dispose(); ContentShare = null; } if (ContentShareAspectRatio != null) { ContentShareAspectRatio.Dispose(); ContentShareAspectRatio = null; } if (ContentText != null) { ContentText.Dispose(); ContentText = null; } if (ContentTextHeight != null) { ContentTextHeight.Dispose(); ContentTextHeight = null; } if (ContentVideo != null) { ContentVideo.Dispose(); ContentVideo = null; } if (ContentVideoAspectRatio != null) { ContentVideoAspectRatio.Dispose(); ContentVideoAspectRatio = null; } if (ContentVideoButtonPlay != null) { ContentVideoButtonPlay.Dispose(); ContentVideoButtonPlay = null; } if (ContentWebView != null) { ContentWebView.Dispose(); ContentWebView = null; } if (ContentWebViewAspectRatio != null) { ContentWebViewAspectRatio.Dispose(); ContentWebViewAspectRatio = null; } if (Creation_Date != null) { Creation_Date.Dispose(); Creation_Date = null; } if (Creation_DateHeight != null) { Creation_DateHeight.Dispose(); Creation_DateHeight = null; } if (GradientImageView != null) { GradientImageView.Dispose(); GradientImageView = null; } if (GradientImageViewAspect != null) { GradientImageViewAspect.Dispose(); GradientImageViewAspect = null; } if (IconContentFriendJoined != null) { IconContentFriendJoined.Dispose(); IconContentFriendJoined = null; } if (IconProductSold != null) { IconProductSold.Dispose(); IconProductSold = null; } if (Label_ContectReward_Claimed != null) { Label_ContectReward_Claimed.Dispose(); Label_ContectReward_Claimed = null; } if (LabelFriendsWelcome != null) { LabelFriendsWelcome.Dispose(); LabelFriendsWelcome = null; } if (LikeButton != null) { LikeButton.Dispose(); LikeButton = null; } if (LikesText != null) { LikesText.Dispose(); LikesText = null; } if (LikesView != null) { LikesView.Dispose(); LikesView = null; } if (LikesViewHeightAspecnRatio != null) { LikesViewHeightAspecnRatio.Dispose(); LikesViewHeightAspecnRatio = null; } if (LineSeparator != null) { LineSeparator.Dispose(); LineSeparator = null; } if (MainBackgroundView != null) { MainBackgroundView.Dispose(); MainBackgroundView = null; } if (MainView != null) { MainView.Dispose(); MainView = null; } if (PointsIconWidthConstraint != null) { PointsIconWidthConstraint.Dispose(); PointsIconWidthConstraint = null; } if (ProductSoldCount != null) { ProductSoldCount.Dispose(); ProductSoldCount = null; } if (ProductSoldMainBackground != null) { ProductSoldMainBackground.Dispose(); ProductSoldMainBackground = null; } if (ProductSoldTitle != null) { ProductSoldTitle.Dispose(); ProductSoldTitle = null; } if (ProductSoldUpBackground != null) { ProductSoldUpBackground.Dispose(); ProductSoldUpBackground = null; } if (PtsText != null) { PtsText.Dispose(); PtsText = null; } if (ReadCommentButtonHeight != null) { ReadCommentButtonHeight.Dispose(); ReadCommentButtonHeight = null; } if (ReadCommentsButton != null) { ReadCommentsButton.Dispose(); ReadCommentsButton = null; } if (RewardClaimedCount != null) { RewardClaimedCount.Dispose(); RewardClaimedCount = null; } if (SmileButton != null) { SmileButton.Dispose(); SmileButton = null; } if (TextContentFriendJoined != null) { TextContentFriendJoined.Dispose(); TextContentFriendJoined = null; } if (TextProductSold != null) { TextProductSold.Dispose(); TextProductSold = null; } if (TextQuoteLineSeparatorHeight != null) { TextQuoteLineSeparatorHeight.Dispose(); TextQuoteLineSeparatorHeight = null; } if (TopActionText != null) { TopActionText.Dispose(); TopActionText = null; } if (TopActionTextHeight != null) { TopActionTextHeight.Dispose(); TopActionTextHeight = null; } if (TopPaddingView != null) { TopPaddingView.Dispose(); TopPaddingView = null; } if (TopPaddingViewAspect != null) { TopPaddingViewAspect.Dispose(); TopPaddingViewAspect = null; } if (TopView != null) { TopView.Dispose(); TopView = null; } if (TopViewHeight != null) { TopViewHeight.Dispose(); TopViewHeight = null; } if (uiProfileButton != null) { uiProfileButton.Dispose(); uiProfileButton = null; } if (vDotsTop != null) { vDotsTop.Dispose(); vDotsTop = null; } if (vDotsTopHeight != null) { vDotsTopHeight.Dispose(); vDotsTopHeight = null; } }
private async void SaveNoteButton_OnClicked(object sender, EventArgs e) { if (ProgenyCollectionView.SelectedItem is Progeny progeny) { _viewModel.IsBusy = true; _viewModel.IsSaving = true; Note saveNote = new Note(); saveNote.ProgenyId = progeny.Id; saveNote.AccessLevel = _viewModel.AccessLevel; saveNote.Progeny = progeny; DateTime noteTime = new DateTime(NoteDatePicker.Date.Year, NoteDatePicker.Date.Month, NoteDatePicker.Date.Day, NoteTimePicker.Time.Hours, NoteTimePicker.Time.Minutes, 0); saveNote.CreatedDate = noteTime; string userEmail = await UserService.GetUserEmail(); UserInfo userinfo = await UserService.GetUserInfo(userEmail); saveNote.Owner = userinfo.UserId; saveNote.Title = TitleEntry.Text; saveNote.Category = CategoryEntry.Text; string noteContent = await ContentWebView.EvaluateJavaScriptAsync("getContent()"); noteContent = noteContent.Replace(@"\u003C", "<"); // Todo: Proper string encoding/decoding. saveNote.Content = noteContent; // saveNote.Content = ContentEditor.Text; if (ProgenyService.Online()) { saveNote = await ProgenyService.SaveNote(saveNote); _viewModel.IsBusy = false; _viewModel.IsSaving = false; if (saveNote.NoteId == 0) { var ci = CrossMultilingual.Current.CurrentCultureInfo; ErrorLabel.Text = resmgr.Value.GetString("ErrorNoteNotSaved", ci); ErrorLabel.BackgroundColor = Color.Red; } else { var ci = CrossMultilingual.Current.CurrentCultureInfo; ErrorLabel.Text = resmgr.Value.GetString("NoteSaved", ci) + saveNote.NoteId; ErrorLabel.BackgroundColor = Color.Green; SaveNoteButton.IsVisible = false; CancelNoteButton.Text = "Ok"; CancelNoteButton.BackgroundColor = Color.FromHex("#4caf50"); await Shell.Current.Navigation.PopModalAsync(); } } else { // Todo: Translate message. ErrorLabel.Text = $"Error: No internet connection. Measurement for {progeny.NickName} was not saved. Try again later."; ErrorLabel.BackgroundColor = Color.Red; } _viewModel.IsBusy = false; _viewModel.IsSaving = false; ErrorLabel.IsVisible = true; } }
/// <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"); }
/// <summary> /// Update when content which are going to to be displayed changed /// </summary> /// <param name="s">S.</param> public async void Update(Subject s) { var hud = new MTMBProgressHUD(View) { LabelText = "Loading", RemoveFromSuperViewOnHide = true }; View.AddSubview(hud); hud.Show(animated: true); OpenedPublication pcs = (OpenedPublication)s; ContentNavigationBar.PopNavigationItem(false); string content = ""; string htmlFilePath = NSBundle.MainBundle.PathForResource("Html/htmlDoc", "html"); string htmlStr = File.ReadAllText(htmlFilePath); NSUrl url = new NSUrl(htmlFilePath); if (pcs.OpendContentType == PublicationContentTypeEnum.TOC) { if (await PageSearchUtil.Instance.IsPBO(AppDataUtil.Instance.GetCurrentPublication().BookId)) { GotoBarButton.Hidden = false; PageNumLabel.Hidden = false; } ContentNavigationBar.PushNavigationItem(ContentNavigationItem, false); content = await PublicationContentUtil.Instance.GetContentFromTOC(pcs.P.BookId, pcs.OpendTOCNode); content = string.Format("<div data-tocid='{0}' data-toctitle='{1}' class='page_container'>{2}</div>", pcs.OpendTOCNode.ID, pcs.OpendTOCNode.Title, content); ContentNavigationItem.LeftBarButtonItems [1].Enabled = AppDataUtil.Instance.CanBack() == true; ContentNavigationItem.LeftBarButtonItems [2].Enabled = AppDataUtil.Instance.CanForward() == true; TOCNode nextPageNode = AppDataUtil.Instance.GetNextOfTOCNodeWithId(pcs.OpendTOCNode.ID, "next"); if (nextPageNode != null) { htmlStr = htmlStr.Replace("#NEXT_PAGE_TITLE#", nextPageNode.Title).Replace("#NEXT_PAGE_TOCID#", nextPageNode.ID.ToString()); } else { htmlStr = htmlStr.Replace("#NEXT_PAGE_TITLE#", "You are on the end.").Replace("#NEXT_PAGE_TOCID#", "-1"); //"-1" here means no next page any more } TOCNode previousPageNode = AppDataUtil.Instance.GetNextOfTOCNodeWithId(pcs.OpendTOCNode.ID, "previous"); if (previousPageNode != null) { htmlStr = htmlStr.Replace("#PREVIOUS_PAGE_TITLE#", previousPageNode.Title).Replace("#PREVIOUS_PAGE_TOCID#", previousPageNode.ID.ToString()); } else { htmlStr = htmlStr.Replace("#PREVIOUS_PAGE_TITLE#", "You are on the begining.").Replace("#PREVIOUS_PAGE_TOCID#", "-1"); //"-1" here means no next page any more } htmlStr = htmlStr.Replace("#PLACE_HOLDER_HIGHLIGHTED_TOCID#", pcs.OpendTOCNode.ID.ToString()); htmlStr = htmlStr.Replace("#PLACE_HOLDER_HIGHLIGHTED_KEYWORD#", AppDataUtil.Instance.HighlightSearchKeyword); AppDataUtil.Instance.HighlightSearchKeyword = ""; // htmlStr = htmlStr.Replace("#PLACE_HOLDER_SCROLL_SCRIPT#", "<script type='text/javascript' src='./JS/infinitescroll.js'></script>"); //When jump to content from index by click content link, selected index of tab bar supposed to be changed to "Contents" NSNotificationCenter.DefaultCenter.PostNotificationName("ChangeContentTabBarSelectedIndex", this, new NSDictionary()); //Suppose to be handled by ContentLeftTabBarController } else if (pcs.OpendContentType == PublicationContentTypeEnum.Index) { //TODO, GotoBarButton.Hidden = true; PageNumLabel.Hidden = true; ContentNavigationBar.PushNavigationItem(IndexNavigationItem, false); if (pcs.OpendIndex == null) { IndexNavigationItem.LeftBarButtonItem.Title = ""; content = "<div class='nocontent'><span>No Index Files Available</span><div>"; } else { IndexNavigationItem.LeftBarButtonItem.Title = pcs.OpendIndex.Title [0].ToString(); content = await PublicationContentUtil.Instance.GetContentFromIndex(pcs.P.BookId, pcs.OpendIndex); content = string.Format("<div class='page_container'>{0}</div>", content); //Scroll to selected index var scrollToSelectedIndexJS = "(function(){if($(\".main\").first().data(\"filename\") != '" + pcs.OpendIndex.FileName + "'){$(window).scrollTo($(\".main[data-filename='" + pcs.OpendIndex.FileName + "']\"), 300);}})();"; htmlStr = htmlStr.Replace("#DOCUMENT_READY_SCRIPT#", scrollToSelectedIndexJS); } htmlStr = htmlStr.Replace("#PLACE_HOLDER_SCROLL_SCRIPT#", ""); } else if (pcs.OpendContentType == PublicationContentTypeEnum.Annotation) { //TODO GotoBarButton.Hidden = true; PageNumLabel.Hidden = true; htmlStr = htmlStr.Replace("#PLACE_HOLDER_SCROLL_SCRIPT#", ""); content = "<div class='nocontent'><span>You have no annotations, highlight text in your publications to add one</span><div>"; } if (content != null) { float defaultFontSize = SettingsUtil.Instance.GetFontSize() > 0 ? SettingsUtil.Instance.GetFontSize() : 14; htmlStr = htmlStr.Replace("#PLACEHOLDER_DEFAULT_FONT_SIZE#", "" + defaultFontSize); htmlStr = htmlStr.Replace("#PLACE_HOLDER_SCROLL_TO_ID#", AppDataUtil.Instance.ScrollToHtmlTagId); htmlStr = htmlStr.Replace("#PLACE_HOLDER_HIGHLIGHTED_KEYWORD#", AppDataUtil.Instance.HighlightSearchKeyword); content = ContentFormatUtil.Format(content); content = Regex.Replace(content, @"<td />", ""); content = Regex.Replace(content, @"<div[^/^>]*?/>", ""); htmlStr = htmlStr.Replace("#CONTENT#", content); ContentWebView.LoadHtmlString(htmlStr, url); } hud.Hide(animated: true, delay: 0.2); }