コード例 #1
0
		async void tweet()
		{
			var tvc = new Twitter.TWTweetComposeViewController();
			var products = await WebService.Shared.GetProducts();
			if(products.Count > 0){
				products.Shuffle ();

				var imageUrl = products.First ().ImageUrl;
				var imagePath = await FileCache.Download (imageUrl);
				tvc.AddImage (UIImage.FromFile (imagePath));
			}
			tvc.AddUrl (NSUrl.FromString("http://xamarin.com/sharp-shirt"));
			tvc.SetInitialText("I just built a native iOS app with C# using #Xamarin and all I got was this free C# t-shirt!");
			PresentViewControllerAsync(tvc, true);
		}
コード例 #2
0
partial         void ShareButton_TouchUpInside(UIButton sender)
        {
            var twit = new Twitter.TWTweetComposeViewController();
            twit.SetInitialText (string.Format("The wheather here will be {0}",DetailItem.ToString ()));

            twit.SetCompletionHandler((TWTweetComposeViewControllerResult r) =>{
                DismissModalViewController(true); // hides the tweet
                if (r == TWTweetComposeViewControllerResult.Cancelled) {
                    new UIAlertView("Canceled", "You just canceled twitt", null, "ok").Show();
                    // user cancelled the tweet
                } else {
                    // user sent the tweet (they may have edited it first)
                }

            });

            PresentModalViewController(twit, true);
        }
コード例 #3
0
        async void tweet()
        {
            var tvc      = new Twitter.TWTweetComposeViewController();
            var products = await WebService.Shared.GetProducts();

            if (products.Count > 0)
            {
                products.Shuffle();

                var imageUrl  = products.First().ImageUrl;
                var imagePath = await FileCache.Download(imageUrl);

                tvc.AddImage(UIImage.FromFile(imagePath));
            }
            tvc.AddUrl(NSUrl.FromString("http://xamarin.com/sharp-shirt"));
            tvc.SetInitialText("I just built a native iOS app with C# using #Xamarin and all I got was this free C# t-shirt!");
            PresentViewControllerAsync(tvc, true);
        }
コード例 #4
0
        partial void ShareButton_TouchUpInside(UIButton sender)
        {
            var twit = new Twitter.TWTweetComposeViewController();

            twit.SetInitialText(string.Format("The wheather here will be {0}", DetailItem.ToString()));

            twit.SetCompletionHandler((TWTweetComposeViewControllerResult r) => {
                DismissModalViewController(true);                 // hides the tweet
                if (r == TWTweetComposeViewControllerResult.Cancelled)
                {
                    new UIAlertView("Canceled", "You just canceled twitt", null, "ok").Show();
                    // user cancelled the tweet
                }
                else
                {
                    // user sent the tweet (they may have edited it first)
                }
            });

            PresentModalViewController(twit, true);
        }