public 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;
                ScrollBottomConstraint_Base      = ScrollBottomConstraint;
                ScrollBottomOuterConstraint_Base = ScrollBottomOuterConstraint;

                SettingsHeaderText.Text           = LangEnglish.MenuSettings;
                NotificationsLabel.Text           = LangEnglish.NotificationsText;
                NotificationsInApp.Text           = LangEnglish.NotificationsInApp;
                NotificationsBackground.Text      = LangEnglish.NotificationsBackground;
                NotificationsNewMatchLabel.Text   = LangEnglish.NotificationsNewMatchText;
                NotificationsNewMessageLabel.Text = LangEnglish.NotificationsNewMessageText;
                NotificationsUnmatchLabel.Text    = LangEnglish.NotificationsUnmatchText;
                NotificationsRematchLabel.Text    = LangEnglish.NotificationsRematchText;

                DisplaySection.Text   = LangEnglish.DisplaySection;
                MapIconSizeLabel.Text = LangEnglish.MapIconSizeText;
                MapRatioLabel.Text    = LangEnglish.MapRatioText;

                LocationHistoryButton.Layer.MasksToBounds = true;
                MessageSend.Layer.MasksToBounds           = true;
                ProgramLogButton.Layer.MasksToBounds      = true;

                MapIconSize.MinValue = Constants.MapIconSizeMin;
                MapIconSize.MaxValue = Constants.MapIconSizeMax;

                MapRatio.MinValue = Constants.MapRatioMin;
                MapRatio.MaxValue = Constants.MapRatioMax;

                LocationLabel.Text = LangEnglish.LocationText;

                InAppLocationRateLabel.Text = LangEnglish.InAppLocationRate;
                InAppLocationRate.MinValue  = Constants.InAppLocationRateMin;
                InAppLocationRate.MaxValue  = Constants.InAppLocationRateMax;

                if (Constants.SafeLocationMode)
                {
                    /*c.CollapseY(BackgroundLocationLabel);
                     * c.CollapseY(BackgroundLocation);
                     * BackgroundLocation.Hidden = true;
                     * c.CollapseY(BackgroundLocationRateLabel);
                     * c.CollapseY(BackgroundLocationRate);
                     * BackgroundLocationRate.Hidden = true;
                     * c.CollapseY(BackgroundLocationRateValue);
                     *
                     * InAppLocationRateLabelConstraint.Constant = 0;
                     * LocationHistoryButtonConstraint.Constant = -5;*/

                    InAppLocationRateExplanation.Text = LangEnglish.InAppLocationRateExplanation;
                }
                else
                {
                    c.CollapseY(InAppLocationRateExplanation);

                    /*BackgroundLocationRateLabelConstraint.Constant = 0;
                     *
                     * BackgroundLocationLabel.Text = LangEnglish.BackgroundLocation;
                     * BackgroundLocationRateLabel.Text = LangEnglish.BackgroundLocationRate;*/
                }

                //BackgroundLocationRate.MinValue = Constants.BackgroundLocationRateMin;
                //BackgroundLocationRate.MaxValue = Constants.BackgroundLocationRateMax;

                LocationHistoryButton.SetTitle(LangEnglish.LocationHistory, UIControlState.Normal);
                SettingsFormCaption.SetTitle(LangEnglish.SettingsFormCaption, UIControlState.Normal);

                MessageSend.SetTitle(LangEnglish.SettingsFormSend, UIControlState.Normal);
                ProgramLogIncluded.Text = LangEnglish.ProgramLogIncluded;
                ProgramLogButton.SetTitle(LangEnglish.SeeProgramLog, UIControlState.Normal);

                c.DrawBorder(MessageEdit);
                c.CollapseY(MessageContainer);

                SettingsBack.TouchDown     += SettingsBack_TouchDown;
                SettingsBack.TouchUpInside += SettingsBack_TouchUpInside;
                MapIconSize.ValueChanged   += MapIconSize_ValueChanged;
                MapRatio.ValueChanged      += MapRatio_ValueChanged;
                //BackgroundLocation.ValueChanged += BackgroundLocation_ValueChanged;
                InAppLocationRate.ValueChanged += InAppLocationRate_ValueChanged;
                //BackgroundLocationRate.ValueChanged += BackgroundLocationRate_ValueChanged;
                LocationHistoryButton.TouchUpInside += LocationHistoryButton_TouchUpInside;
                SettingsFormCaption.TouchUpInside   += SettingsFormCaption_TouchUpInside;
                MessageSend.TouchUpInside           += SettingsMessageSend_TouchUpInside;
                ProgramLogButton.TouchUpInside      += ProgramLogButton_TouchUpInside;
            }
            catch (Exception ex)
            {
                c.ReportErrorSilent(ex.Message + Environment.NewLine + ex.StackTrace);
            }
        }
示例#2
0
        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);
            }
        }