partial void RegisterButtonClicked(Foundation.NSObject sender) { if (!ShowedEULA) { UINavigationController nc = new UINavigationController(); nc.NavigationBar.BackgroundColor = UIColor.White; nc.NavigationBar.TintColor = UIColor.Blue; nc.NavigationBar.BarTintColor = UIColor.White; WebViewController vc = new WebViewController(); vc.NavigationItem.RightBarButtonItem = new UIBarButtonItem(Strings.accept, UIBarButtonItemStyle.Plain, delegate { nc.DismissViewController(true, delegate { ShowedEULA = true; PerformSegue("Landing2Register", this); }); }); vc.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(Strings.cancel, UIBarButtonItemStyle.Plain, delegate { nc.DismissViewController(true, null); }); vc.NavigationItem.RightBarButtonItem.Enabled = false; vc.NavigationItem.LeftBarButtonItem.Enabled = false; vc.URL = Strings.web_url_base + Strings.web_url_privacy_policy; nc.SetViewControllers(new UIViewController[] { vc }, false); this.PresentViewController(nc, true, null); } else { PerformSegue("Landing2Register", this); } }
public override void RowSelected(UITableView tableView, Foundation.NSIndexPath indexPath) { string textOfCell = (string)Master.TableData[(int)indexPath.Section]["Rows"][indexPath.Row]; WebViewController wvc = new WebViewController(); wvc.URL = Strings.web_url_base; if (indexPath.Section == 0) { if (textOfCell == "Edit Profile") { EditProfileViewController vc = (EditProfileViewController)Master.Storyboard.InstantiateViewController("EditProfileViewController"); Master.NavigationController.PushViewController(vc, true); return; } if (textOfCell == "Change Password") { ChangePasswordViewController vc = (ChangePasswordViewController)Master.Storyboard.InstantiateViewController("ChangePasswordViewController"); Master.NavigationController.PushViewController(vc, true); return; } } if (indexPath.Section == 1) { if (textOfCell == "Report") { wvc.URL += "report.html"; Master.NavigationController.PushViewController(wvc, true); return; } if (textOfCell == "Feedback") { wvc.URL += Strings.web_url_feedback; Master.NavigationController.PushViewController(wvc, true); return; } } if (indexPath.Section == 2) { if (textOfCell == "Blog/Website") { wvc.URL += ""; Master.NavigationController.PushViewController(wvc, true); return; } if (textOfCell == "Privacy Policy") { wvc.URL += Strings.web_url_privacy_policy; Master.NavigationController.PushViewController(wvc, true); return; } if (textOfCell == "Terms") { wvc.URL += Strings.web_url_terms; Master.NavigationController.PushViewController(wvc, true); return; } } if (indexPath.Section == 3) { if (textOfCell == "Blocked User") { wvc.URL = textOfCell; Master.NavigationController.PushViewController(wvc, true); return; } if (textOfCell == "Sign Out") { var AlertController = UIAlertController.Create(Strings.logout_comfirm, null, UIAlertControllerStyle.ActionSheet); AlertController.AddAction(UIAlertAction.Create(Strings.logout, UIAlertActionStyle.Destructive, alert => Logout())); AlertController.AddAction(UIAlertAction.Create(Strings.cancel, UIAlertActionStyle.Cancel, null)); Master.PresentViewController(AlertController, true, null); return; } } }
private void SetupTermsTextView() { NSMutableParagraphStyle paragraphStyle = new NSMutableParagraphStyle(); paragraphStyle.Alignment = UITextAlignment.Center; NSMutableAttributedString attributedString = new NSMutableAttributedString(Strings.accept_terms_and_conditions_to_continue); attributedString.BeginEditing(); attributedString.AddAttribute(UIStringAttributeKey.Font, UIFont.FromName("Arial", 11), new NSRange(0, attributedString.Value.Length)); attributedString.AddAttribute(UIStringAttributeKey.ForegroundColor, UIColor.White, new NSRange(0, attributedString.Value.Length)); attributedString.AddAttribute(UIStringAttributeKey.ParagraphStyle, paragraphStyle, new NSRange(0, attributedString.Value.Length)); attributedString.AddAttribute(UIStringAttributeKey.ForegroundColor, UIColor.Blue, new NSRange(Strings.accept_terms_and_conditions_to_continue.IndexOf("Privacy Policy.", StringComparison.Ordinal), 15)); attributedString.AddAttribute(UIStringAttributeKey.ForegroundColor, UIColor.Blue, new NSRange(Strings.accept_terms_and_conditions_to_continue.IndexOf("Terms", StringComparison.Ordinal), 5)); attributedString.EndEditing(); TermsTextView.AttributedText = attributedString; TermsTextView.SizeToFit(); UITapGestureRecognizer tapGesture = new UITapGestureRecognizer(delegate (UITapGestureRecognizer obj) { try { UITextRange textRange = TermsTextView.Tokenizer.GetRangeEnclosingPosition(TermsTextView.GetClosestPositionToPoint(obj.LocationInView(TermsTextView)), UITextGranularity.Word, UITextDirection.Forward); string clickedString = TermsTextView.Text.Substring((int)TermsTextView.GetOffsetFromPosition(TermsTextView.BeginningOfDocument, textRange.Start), 5); if (clickedString.Contains("Priva") || clickedString.Contains("Polic")) { WebViewController wvc = new WebViewController(); wvc.URL = Strings.web_url_base + Strings.web_url_privacy_policy; this.NavigationController.PushViewController(wvc, true); return; } if (clickedString.Contains("Terms")) { WebViewController wvc = new WebViewController(); wvc.URL = Strings.web_url_base + Strings.web_url_terms; this.NavigationController.PushViewController(wvc, true); return; } } catch (Exception) { return; } }); TermsTextView.AddGestureRecognizer(tapGesture); }