void ReleaseDesignerOutlets() { if (BottomConstraint != null) { BottomConstraint.Dispose(); BottomConstraint = null; } if (HelpCenterBack != null) { HelpCenterBack.Dispose(); HelpCenterBack = null; } if (HelpCenterFormCaption != null) { HelpCenterFormCaption.Dispose(); HelpCenterFormCaption = null; } if (HelpCenterHeaderText != null) { HelpCenterHeaderText.Dispose(); HelpCenterHeaderText = null; } if (LoaderCircle != null) { LoaderCircle.Dispose(); LoaderCircle = null; } if (MessageContainer != null) { MessageContainer.Dispose(); MessageContainer = null; } if (MessageEdit != null) { MessageEdit.Dispose(); MessageEdit = null; } if (MessageSend != null) { MessageSend.Dispose(); MessageSend = null; } if (OpenTutorial != null) { OpenTutorial.Dispose(); OpenTutorial = null; } if (QuestionsScroll != null) { QuestionsScroll.Dispose(); QuestionsScroll = null; } if (RippleHelpCenter != null) { RippleHelpCenter.Dispose(); RippleHelpCenter = null; } if (RippleTutorial1 != null) { RippleTutorial1.Dispose(); RippleTutorial1 = null; } if (RippleTutorial2 != null) { RippleTutorial2.Dispose(); RippleTutorial2 = null; } if (RoundBottom != null) { RoundBottom.Dispose(); RoundBottom = null; } if (RoundBottomTutorial != null) { RoundBottomTutorial.Dispose(); RoundBottomTutorial = null; } if (Snackbar != null) { Snackbar.Dispose(); Snackbar = null; } if (SnackBottomConstraint != null) { SnackBottomConstraint.Dispose(); SnackBottomConstraint = null; } if (SnackTopConstraint != null) { SnackTopConstraint.Dispose(); SnackTopConstraint = null; } if (TutorialBack != null) { TutorialBack.Dispose(); TutorialBack = null; } if (TutorialBottomSeparator != null) { TutorialBottomSeparator.Dispose(); TutorialBottomSeparator = null; } if (TutorialFrame != null) { TutorialFrame.Dispose(); TutorialFrame = null; } if (TutorialFrameBg != null) { TutorialFrameBg.Dispose(); TutorialFrameBg = null; } if (TutorialLoadNext != null) { TutorialLoadNext.Dispose(); TutorialLoadNext = null; } if (TutorialLoadPrevious != null) { TutorialLoadPrevious.Dispose(); TutorialLoadPrevious = null; } if (TutorialNavBar != null) { TutorialNavBar.Dispose(); TutorialNavBar = null; } if (TutorialNavText != null) { TutorialNavText.Dispose(); TutorialNavText = null; } if (TutorialText != null) { TutorialText.Dispose(); TutorialText = null; } if (TutorialTopBar != null) { TutorialTopBar.Dispose(); TutorialTopBar = null; } if (TutorialTopSeparator != null) { TutorialTopSeparator.Dispose(); TutorialTopSeparator = null; } }
public async override void ViewDidLoad() { try { base.ViewDidLoad(); c.AddViews(Snackbar, Snackbar.SnackText, Snackbar.SnackButton); RoundBottom_Base = RoundBottom; Snackbar_Base = Snackbar; BottomConstraint_Base = BottomConstraint; SnackTopConstraint_Base = SnackTopConstraint; SnackBottomConstraint_Base = SnackBottomConstraint; HelpCenterHeaderText.Text = LangEnglish.MenuHelpCenter; HelpCenterFormCaption.SetTitle(LangEnglish.HelpCenterFormCaption, UIControlState.Normal); MessageSend.SetTitle(LangEnglish.HelpCenterFormSend, UIControlState.Normal); OpenTutorial.SetTitle(LangEnglish.HelpCenterTutorial, UIControlState.Normal); TutorialFrame.Delegate = this; OpenTutorial.Layer.MasksToBounds = true; MessageSend.Layer.MasksToBounds = true; var tap = new UITapGestureRecognizer(); tap.AddTarget(() => TutorialFrame_Click(tap)); TutorialFrame.AddGestureRecognizer(tap); c.DrawBorder(MessageEdit); c.CollapseY(MessageContainer); HelpCenterBack.TouchDown += HelpCenterBack_TouchDown; HelpCenterBack.TouchUpInside += HelpCenterBack_TouchUpInside; OpenTutorial.TouchUpInside += OpenTutorial_TouchUpInside; HelpCenterFormCaption.TouchUpInside += HelpCenterFormCaption_TouchUpInside; MessageSend.TouchUpInside += MessageSend_TouchUpInside; TutorialBack.TouchDown += TutorialBack_TouchDown; TutorialBack.TouchUpInside += TutorialBack_TouchUpInside; TutorialLoadNext.TouchDown += TutorialLoad_TouchDown; TutorialLoadNext.TouchUpInside += TutorialLoadNext_TouchUpInside; TutorialLoadPrevious.TouchDown += TutorialLoad_TouchDown; TutorialLoadPrevious.TouchUpInside += TutorialLoadPrevious_TouchUpInside; string responseString = await c.MakeRequest("action=helpcenter"); if (responseString.Substring(0, 2) == "OK") { c.RemoveSubviews(QuestionsScroll); responseString = responseString.Substring(3); string[] lines = responseString.Split("\t"); int count = 0; foreach (string line in lines) { count++; UILabel text = new UILabel(); QuestionsScroll.AddSubview(text); text.Text = line; text.TextColor = UIColor.FromName("PrimaryDark"); text.Lines = 0; text.LineBreakMode = UILineBreakMode.WordWrap; if (count % 2 == 1) //question, change font weight { text.Font = UIFont.BoldSystemFontOfSize(14); } else { text.Font = UIFont.SystemFontOfSize(14); } text.TranslatesAutoresizingMaskIntoConstraints = false; text.LeftAnchor.ConstraintEqualTo(QuestionsScroll.LeftAnchor, 15).Active = true; text.RightAnchor.ConstraintEqualTo(QuestionsScroll.RightAnchor, -15).Active = true; text.WidthAnchor.ConstraintEqualTo(QuestionsScroll.WidthAnchor, 1, -30).Active = true; if (count == 1) { text.TopAnchor.ConstraintEqualTo(QuestionsScroll.TopAnchor, 15).Active = true; } else { text.TopAnchor.ConstraintEqualTo(QuestionsScroll.Subviews[count - 2].BottomAnchor, 10).Active = true; } if (count == lines.Length) { NSLayoutConstraint constraint = text.BottomAnchor.ConstraintEqualTo(QuestionsScroll.BottomAnchor, -15); constraint.Priority = 200; //in case there are fewer questions than what would fill the page, priority needs to be lower than the texts' hugging priority. constraint.Active = true; } } } else { c.ReportError(responseString); } } catch (Exception ex) { c.ReportErrorSilent(ex.Message + Environment.NewLine + ex.StackTrace); } }