Exemplo n.º 1
0
        void ReleaseDesignerOutlets()
        {
            if (account_settings_title != null)
            {
                account_settings_title.Dispose();
                account_settings_title = null;
            }

            if (BioText != null)
            {
                BioText.Dispose();
                BioText = null;
            }

            if (BtnLocationSettings != null)
            {
                BtnLocationSettings.Dispose();
                BtnLocationSettings = null;
            }

            if (CityText != null)
            {
                CityText.Dispose();
                CityText = null;
            }

            if (DisplayNameText != null)
            {
                DisplayNameText.Dispose();
                DisplayNameText = null;
            }

            if (EmailText != null)
            {
                EmailText.Dispose();
                EmailText = null;
            }

            if (first_label_account_settings_title != null)
            {
                first_label_account_settings_title.Dispose();
                first_label_account_settings_title = null;
            }

            if (lblBio != null)
            {
                lblBio.Dispose();
                lblBio = null;
            }

            if (lblCity != null)
            {
                lblCity.Dispose();
                lblCity = null;
            }

            if (lblComments != null)
            {
                lblComments.Dispose();
                lblComments = null;
            }

            if (lblCount != null)
            {
                lblCount.Dispose();
                lblCount = null;
            }

            if (lblDiscoverDescription != null)
            {
                lblDiscoverDescription.Dispose();
                lblDiscoverDescription = null;
            }

            if (lblDiscoverTeams != null)
            {
                lblDiscoverTeams.Dispose();
                lblDiscoverTeams = null;
            }

            if (lblDisplayName != null)
            {
                lblDisplayName.Dispose();
                lblDisplayName = null;
            }

            if (lblEmail != null)
            {
                lblEmail.Dispose();
                lblEmail = null;
            }

            if (lblHideSocialNetworks != null)
            {
                lblHideSocialNetworks.Dispose();
                lblHideSocialNetworks = null;
            }

            if (lblLikes != null)
            {
                lblLikes.Dispose();
                lblLikes = null;
            }

            if (lblLocation != null)
            {
                lblLocation.Dispose();
                lblLocation = null;
            }

            if (lblName != null)
            {
                lblName.Dispose();
                lblName = null;
            }

            if (lblNotifications != null)
            {
                lblNotifications.Dispose();
                lblNotifications = null;
            }

            if (lblPrivacy != null)
            {
                lblPrivacy.Dispose();
                lblPrivacy = null;
            }

            if (lblProfile != null)
            {
                lblProfile.Dispose();
                lblProfile = null;
            }

            if (left_side_margin_view != null)
            {
                left_side_margin_view.Dispose();
                left_side_margin_view = null;
            }

            if (MainScroll != null)
            {
                MainScroll.Dispose();
                MainScroll = null;
            }

            if (MainScrollBottomConstraint != null)
            {
                MainScrollBottomConstraint.Dispose();
                MainScrollBottomConstraint = null;
            }

            if (Name_Divider != null)
            {
                Name_Divider.Dispose();
                Name_Divider = null;
            }

            if (Name_View != null)
            {
                Name_View.Dispose();
                Name_View = null;
            }

            if (Name_View_Aspect != null)
            {
                Name_View_Aspect.Dispose();
                Name_View_Aspect = null;
            }

            if (NameText != null)
            {
                NameText.Dispose();
                NameText = null;
            }

            if (parent != null)
            {
                parent.Dispose();
                parent = null;
            }

            if (rightLoMargin != null)
            {
                rightLoMargin.Dispose();
                rightLoMargin = null;
            }

            if (second_label_account_settings_title != null)
            {
                second_label_account_settings_title.Dispose();
                second_label_account_settings_title = null;
            }

            if (swComments != null)
            {
                swComments.Dispose();
                swComments = null;
            }

            if (swDiscoverTeams != null)
            {
                swDiscoverTeams.Dispose();
                swDiscoverTeams = null;
            }

            if (swHideSocialNetworks != null)
            {
                swHideSocialNetworks.Dispose();
                swHideSocialNetworks = null;
            }

            if (swLikes != null)
            {
                swLikes.Dispose();
                swLikes = null;
            }

            if (swNotifications != null)
            {
                swNotifications.Dispose();
                swNotifications = null;
            }

            if (VersionNumber != null)
            {
                VersionNumber.Dispose();
                VersionNumber = null;
            }

            if (ViewHideBlockDiscover != null)
            {
                ViewHideBlockDiscover.Dispose();
                ViewHideBlockDiscover = null;
            }

            if (ViewHideBlockNotification != null)
            {
                ViewHideBlockNotification.Dispose();
                ViewHideBlockNotification = null;
            }
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            DisplayNameText.Text = StringWithEmojiConverter.ConvertEmojiFromServer(SL.Profile.UserName);//need to anderstand difference from NameText
            CityText.Text        = SL.Profile.City ?? "";
            NameOfCity           = SL.Profile.City ?? "";
            NameText.Text        = SL.Profile.UserName;

            CityText.EditingChanged += (s, e) =>
            {
                CityText.Text = CheckText(CityText.Text);
            };

            EmailText.EditingDidEnd += (s, e) =>
            {
                var profile = SL.Profile;
                profile.EmailAddress = EmailText.Text;
                SL.Manager.SaveProfileAsync(profile);
                SL.Profile = profile;
            };

            NameText.ShouldReturn = delegate
            {
                NameText.EndEditing(true);
                return(true);
            };

            DisplayNameText.ShouldReturn = delegate
            {
                DisplayNameText.EndEditing(true);
                return(true);
            };

            CityText.ShouldReturn = delegate
            {
                CityText.EndEditing(true);
                return(true);
            };

            EmailText.ShouldReturn = delegate
            {
                EmailText.EndEditing(true);
                return(true);
            };

            var tap = new UITapGestureRecognizer(() =>
            {
                foreach (var view in View.Subviews[0].Subviews[0].Subviews)
                {
                    if (view is UITextView text)
                    {
                        text.ResignFirstResponder();
                    }
                    if (view is UITextField text1)
                    {
                        text1.ResignFirstResponder();
                    }
                }
            });

            View.AddGestureRecognizer(tap);

            EmailText.Text = SL.Profile.EmailAddress;

            var version = NSBundle.MainBundle.InfoDictionary["CFBundleVersion"];//NSBundle.MainBundle.InfoDictionary["CFBundleShortVersionString"];

            VersionNumber.Text = $"v{version.Description}";

            #region v2
            //swFromElectricAdvinture.On = SL.AppSettings.GetValueOrDefault("FromElectricAdvintureEnabled", false);
            //swFromElectricAdvinture.ValueChanged += SwFromElectricAdvinture_ValueChanged;

            //Need remove to v.2
            Name_View.TranslatesAutoresizingMaskIntoConstraints = false;
            Name_Divider.Hidden = true;
            Name_View.RemoveConstraint(Name_View_Aspect);
            Name_View.AddConstraint(NSLayoutConstraint.Create(Name_View, NSLayoutAttribute.Height, NSLayoutRelation.Equal, 0, 0));
            Name_View.UpdateConstraints();
            #endregion

            swComments.On            = SL.AppSettings.GetValueOrDefault("CommentsEnabled", false);
            swComments.ValueChanged += SwComments_ValueChanged;

            swLikes.On            = SL.AppSettings.GetValueOrDefault("LikesEnabled", false);
            swLikes.ValueChanged += SwLikes_ValueChanged;

            swDiscoverTeams.On            = SL.AppSettings.GetValueOrDefault("DiscoverTeamsEnabled", false);
            swDiscoverTeams.ValueChanged += SwDiscoverTeams_ValueChanged;

            swHideSocialNetworks.On            = SL.AppSettings.GetValueOrDefault("HideSocialNetworksEnabled", false);
            swHideSocialNetworks.ValueChanged += SwHideSocialNetworks_ValueChanged;

            #region v1
            var notificationStatus = SL.AppSettings.GetValueOrDefault("NotificationStatus", string.Empty);
            swNotifications.On            = notificationStatus.Equals(Enums.NotififcationStatus.Enabled.ToString()) ? true : false;
            swNotifications.ValueChanged += SwNotifications_ValueChanged;

            //SetupNotificationSwitch();

            ViewHideBlockDiscover.AddConstraint(NSLayoutConstraint.Create(ViewHideBlockDiscover, NSLayoutAttribute.Height, NSLayoutRelation.Equal, 1, 0));
            ViewHideBlockNotification.AddConstraint(NSLayoutConstraint.Create(ViewHideBlockNotification, NSLayoutAttribute.Height, NSLayoutRelation.Equal, 1, 0));
            View.UpdateConstraints();
            #endregion
        }