Example #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            SetBindings();
            SetCommands();
            BaseStyling();
            EventStyling();

            NavigationBar.Set(this, HomeButton, FriendsButton, AddPostButton, ProfileButton);

            UserPostsCollectionView.RegisterNibForCell(PostCollectionViewCell.Nib, PostCollectionViewCell.Key);
            UserPostsCollectionView.RegisterNibForSupplementaryView(HeaderCollectionViewCell.Nib, UICollectionElementKindSection.Header, HeaderCollectionViewCell.Key);

            var layout = new UICollectionViewFlowLayout
            {
                ItemSize            = new CoreGraphics.CGSize(100, 100),
                HeaderReferenceSize = new CoreGraphics.CGSize(122, 20)
            };

            UserPostsCollectionView.SetCollectionViewLayout(layout, true);

            UserPostsCollectionView.Source = source;
            UserPostsCollectionView.ReloadData();

            LogoutButton.TouchUpInside += (o, e) =>
            {
                CurrentUser.UserId = string.Empty;
                Navigator.Navigate(this, CtrConst.LoginController);
            };

            UserImageView.ClipsToBounds = true;
            UserImageView.ContentMode   = UIViewContentMode.ScaleAspectFill;

            ImageService.Instance.LoadUrl(dataContext.ImagePath)
            .DownSample(80, 80).Into(UserImageView);
        }
        void ReleaseDesignerOutlets()
        {
            if (AddPostButton != null)
            {
                AddPostButton.Dispose();
                AddPostButton = null;
            }

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

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

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

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

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

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

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

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

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

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

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

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

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