Пример #1
0
        public TweetDetailsScreen(BL.Tweet showTweet)
            : base()
        {
            tweet = showTweet;

            View.BackgroundColor = UIColor.White;

            user = new UILabel () {
                TextAlignment = UITextAlignment.Left,
                Font = UIFont.FromName("Helvetica-Light",AppDelegate.Font16pt),
                BackgroundColor = UIColor.FromWhiteAlpha (0f, 0f)
            };
            handle = new UnderlineLabel () {
                TextAlignment = UITextAlignment.Left,
                Font = UIFont.FromName("Helvetica-Light",AppDelegate.Font9pt),
                TextColor = AppDelegate.ColorTextLink,

                BackgroundColor = UIColor.FromWhiteAlpha (0f, 0f)
            };
            handleButton = UIButton.FromType (UIButtonType.Custom);
            handleButton.TouchUpInside += (sender, e) => {
                var url = new NSUrl(tweet.AuthorUrl);
                var request = new NSUrlRequest(url);
                if (AppDelegate.IsPhone)
                    NavigationController.PushViewController (new WebViewController (request), true);
                else
                    PresentModalViewController (new WebViewController(request), true);
            };
            date = new UILabel () {
                TextAlignment = UITextAlignment.Left,
                Font = UIFont.FromName("Helvetica-Light",AppDelegate.Font9pt),
                TextColor = UIColor.DarkGray,
                BackgroundColor = UIColor.FromWhiteAlpha (0f, 0f)
            };

            image = new UIImageView();

            webView = new UIWebView();
            webView.Delegate = new WebViewDelegate(this);
            try { // iOS5 only
                webView.ScrollView.ScrollEnabled = false;
                webView.ScrollView.Bounces = false;
            } catch {}

            View.AddSubview (user);
            View.AddSubview (handle);
            View.AddSubview (handleButton);
            View.AddSubview (image);
            View.AddSubview (date);
            View.AddSubview (webView);

            LayoutSubviews();
            if (tweet != null)
                Update ();
        }
Пример #2
0
        protected override void OnElementChanged(ElementChangedEventArgs <Label> e)
        {
            base.OnElementChanged(e);

            if (e.NewElement != null)
            {
                UnderlineLabel lbl = Element as UnderlineLabel;
                if (lbl.HasUnderline)
                {
                    SetUnderline(true);
                }
            }
        }
        public TweetDetailsScreen(BL.Tweet showTweet) : base()
        {
            tweet = showTweet;

            View.BackgroundColor = UIColor.White;

            user = new UILabel()
            {
                TextAlignment   = UITextAlignment.Left,
                Font            = UIFont.FromName("Helvetica-Light", AppDelegate.Font16pt),
                BackgroundColor = UIColor.FromWhiteAlpha(0f, 0f)
            };
            handle = new UnderlineLabel()
            {
                TextAlignment = UITextAlignment.Left,
                Font          = UIFont.FromName("Helvetica-Light", AppDelegate.Font9pt),
                TextColor     = AppDelegate.ColorTextLink,

                BackgroundColor = UIColor.FromWhiteAlpha(0f, 0f)
            };
            handleButton = UIButton.FromType(UIButtonType.Custom);
            handleButton.TouchUpInside += (sender, e) => {
                var url     = new NSUrl(tweet.AuthorUrl);
                var request = new NSUrlRequest(url);
                if (AppDelegate.IsPhone)
                {
                    NavigationController.PushViewController(new WebViewController(request), true);
                }
                else
                {
                    PresentModalViewController(new WebViewController(request), true);
                }
            };
            date = new UILabel()
            {
                TextAlignment   = UITextAlignment.Left,
                Font            = UIFont.FromName("Helvetica-Light", AppDelegate.Font9pt),
                TextColor       = UIColor.DarkGray,
                BackgroundColor = UIColor.FromWhiteAlpha(0f, 0f)
            };

            image = new UIImageView();

            webView          = new UIWebView();
            webView.Delegate = new WebViewDelegate(this);
            try {             // iOS5 only
                webView.ScrollView.ScrollEnabled = false;
                webView.ScrollView.Bounces       = false;
            } catch {}

            View.AddSubview(user);
            View.AddSubview(handle);
            View.AddSubview(handleButton);
            View.AddSubview(image);
            View.AddSubview(date);
            View.AddSubview(webView);

            LayoutSubviews();
            if (tweet != null)
            {
                Update();
            }
        }