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;
            }
        }
        /// <summary>
        /// Create Video Player.
        /// </summary>
        /// <param name="video"></param>
        private void SetVideo(string video)
        {
            var profile = Windows.Networking.Connectivity.NetworkInformation.GetInternetConnectionProfile();

            if (profile != null)
            {
                var interfaceType = profile.NetworkAdapter.IanaInterfaceType;

                if (interfaceType == 71)
                {
                    //Wifi
                    _youTubeButton = new YouTubeButton {
                        YouTubeID = _videoId
                    };
                    _youTubeButton.Click += youTubeButton_Click;

                    LayoutRoot.Children.Clear();
                    LayoutRoot.Children.Add(_youTubeButton);
                }
                else
                {
                    //Other
                    var web = new WebBrowser()
                    {
                        Height          = 600,
                        IsScriptEnabled = true
                    };

                    web.NavigateToString(string.Format("<!doctype html>" +
                                                       "<html><head><title></title></head><body style=background-color:black;>" +
                                                       "<iframe height=\"600\" src=\"http://www.youtube.com/embed/{0}\" width=\"1000\"></iframe>" +
                                                       "</body></html>", video));

                    LayoutRoot.Children.Clear();
                    LayoutRoot.Children.Add(web);
                }
            }
        }
Пример #3
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.";
        }