void ReleaseDesignerOutlets()
        {
            if (ScrollView != null)
            {
                ScrollView.Dispose();
                ScrollView = null;
            }

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

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

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

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

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

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

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

            if (BlogRssButton != null)
            {
                BlogRssButton.Dispose();
                BlogRssButton = null;
            }
        }
示例#2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            Title = "About Xamarin";

            StackOverflowButton.SetBackgroundImage(UIImage.FromFile("Images/Logos/logo_stackoverflow.png"), UIControlState.Normal);
            LinkedInButton.SetBackgroundImage(UIImage.FromFile("Images/Logos/logo_linkedin.png"), UIControlState.Normal);
            TwitterButton.SetBackgroundImage(UIImage.FromFile("Images/Logos/logo_twitter.png"), UIControlState.Normal);
            YouTubeButton.SetBackgroundImage(UIImage.FromFile("Images/Logos/logo_youtube.png"), UIControlState.Normal);
            FacebookButton.SetBackgroundImage(UIImage.FromFile("Images/Logos/logo_facebook.png"), UIControlState.Normal);
            BlogRssButton.SetBackgroundImage(UIImage.FromFile("Images/Logos/logo_rss.png"), UIControlState.Normal);


            StackOverflowButton.TouchUpInside += (sender, e) => { OpenUrl(Constants.AboutUrlStackOverflow); };
            LinkedInButton.TouchUpInside      += (sender, e) => { OpenUrl(Constants.AboutUrlLinkedIn); };
            TwitterButton.TouchUpInside       += (sender, e) => { OpenUrl(Constants.AboutUrlTwitter); };
            YouTubeButton.TouchUpInside       += (sender, e) => { OpenUrl(Constants.AboutUrlYouTube); };
            FacebookButton.TouchUpInside      += (sender, e) => { OpenUrl(Constants.AboutUrlFacebook); };
            BlogRssButton.TouchUpInside       += (sender, e) => { OpenUrl(Constants.AboutUrlBlogRss); };


            if (AppDelegate.IsPhone)
            {
                ScrollView.Frame       = new CGRect(0, 43, 320, 367);
                ScrollView.ContentSize = new CGSize(320, 610);

                XamLogoImageView.Image = UIImage.FromBundle("/Images/About");

                AboutTextView.Frame = new CGRect(
                    AboutTextView.Frame.X,
                    AboutTextView.Frame.Y,
                    320,
                    240);

                var Y = AboutTextView.Frame.Y + 240;

                StackOverflowButton.Frame = new CGRect(StackOverflowButton.Frame.X, Y, StackOverflowButton.Frame.Width, StackOverflowButton.Frame.Height);
                LinkedInButton.Frame      = new CGRect(LinkedInButton.Frame.X, Y, LinkedInButton.Frame.Width, LinkedInButton.Frame.Height);
                TwitterButton.Frame       = new CGRect(TwitterButton.Frame.X, Y, TwitterButton.Frame.Width, TwitterButton.Frame.Height);
                YouTubeButton.Frame       = new CGRect(YouTubeButton.Frame.X, Y, YouTubeButton.Frame.Width, YouTubeButton.Frame.Height);
                FacebookButton.Frame      = new CGRect(FacebookButton.Frame.X, Y, FacebookButton.Frame.Width, FacebookButton.Frame.Height);
                BlogRssButton.Frame       = new CGRect(BlogRssButton.Frame.X, Y, BlogRssButton.Frame.Width, BlogRssButton.Frame.Height);
            }
            else
            {
                // IsPad
                ScrollView.Frame       = new CGRect(0, 0, 768, 1004);
                ScrollView.ContentSize = new CGSize(768, 1024);

                XamLogoImageView.Image = UIImage.FromBundle("/Images/About-Portrait~iPad");
                XamLogoImageView.Frame = ScrollView.Frame;

                CGSize size = UIStringDrawing.StringSize(AboutTextView.Text
                                                         , AboutTextView.Font
                                                         , new SizeF(738, 500)
                                                         , UILineBreakMode.WordWrap);

                AboutTextView.Frame = new CGRect(
                    15,
                    650,
                    size.Width,
                    size.Height + 30);
                //AboutTextView.AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleWidth;

                var Y = AboutTextView.Frame.Y + size.Height + 40;

                StackOverflowButton.AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin;
                LinkedInButton.AutoresizingMask      = UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin;
                TwitterButton.AutoresizingMask       = UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin;
                YouTubeButton.AutoresizingMask       = UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin;
                BlogRssButton.AutoresizingMask       = UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin;
                FacebookButton.AutoresizingMask      = UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin;

                LayoutButtons(Y);
            }
            AboutTextView.Text = Constants.AboutText;             // @"Xamarin was founded in 2011 with the mission to make it fast, easy and fun to build great mobile apps. Xamarin’s products are used by individual developers and companies, including VMware, Target, Rdio, Medtronic and Unity Technologies, to simplify creation and operation of high-performance, cross-platform mobile consumer and corporate applications, targeting phones and tablets running iOS, Android and Windows. For more information, visit http://xamarin.com.";
        }