Пример #1
0
        void Sharing(Xamarin.Social.Service service, Button shareButton)
        {
            Item item = new Item {
                Text = "I'm sharing great things using Xamarin!"
            };

            Intent intent = service.GetShareUI (this, item, shareResult => {
                shareButton.Text = service.Title + " shared: " + shareResult;
            });

            StartActivity (intent);
        }
Пример #2
0
		void Share (Xamarin.Social.Service service)
		{
			if (fileName == string.Empty || fileName == "in-progress")
				return;

			// 2. Create an item to share
			var text = "Xamarin.SoMA ... Social Mobile & Auth! ";
			if (shareItem != null) { // use the existing one passed to the activity
				text = shareItem.Text;
				fileName = shareItem.ImagePath;
				location = shareItem.Location;
			}
			var item = new Item { Text = text };
			item.Images.Add (new ImageData (fileName));
			if (isLocationSet)
				item.Links.Add (new Uri ( "https://maps.google.com/maps?q=" + location));

			// 3. Present the UI on Android
			var shareIntent = service.GetShareUI (this, item, result => {
				// result lets you know if the user shared the item or canceled
				if (result == ShareResult.Cancelled)
					return;

				Console.WriteLine ("{0} shared", service.Title);

				// 4. Now save to the database for the MainScreen list
				var si = new ShareItem {
					Text = item.Text, // get the edited text from the share UI
					ImagePath = fileName,
					Location = location
				};
				if (item.Links.Count > 0) si.Link = item.Links[0].AbsoluteUri;
				si.SocialType = service.Title;

				App.Database.SaveItem(si);
				shareItem = si; // replace the one in the activity
			});
			StartActivity (shareIntent);
		}
Пример #3
0
		//Evento de publicacion Estado
		void Share (Xamarin.Social.Service service, string textshare)
		{
			Item item = new Item {
				Text = textshare,
			};

			Intent intent = service.GetShareUI (this, item, shareResult => {
				RunOnUiThread(()=>{
					Toast.MakeText(this, shareResult.ToString(), ToastLength.Short).Show();
				});
			});

			StartActivity (intent);
		}
Пример #4
0
		//Evento de publicacion Fotografia
		void ShareImage (Xamarin.Social.Service service, string textshare)
		{
			Item item = new Item {
				Text = textshare,
			};
			item.Images.Add(new ImageData(BitmapFactory.DecodeFile(_Archivo.AbsoluteFile.ToString())));
			Intent intent = service.GetShareUI (this, item, shareResult => {
				RunOnUiThread(()=>{
					Toast.MakeText(this, shareResult.ToString(), ToastLength.Short).Show();
				});
			});

			StartActivity (intent);
		}
Пример #5
0
		//Evento de publicacion Estado+Link
		void ShareLink (Xamarin.Social.Service service, string textshare)
		{
			Item item = new Item {
				Text = textshare,
				Links = new List<Uri> {
					new Uri ("http://alejandroruizvarela.blogspot.mx/"),
				},
			};

			Intent intent = service.GetShareUI (this, item, shareResult => {
				RunOnUiThread(()=>{
					Toast.MakeText(this, shareResult.ToString(), ToastLength.Short).Show();
				});
			});

			StartActivity (intent);
		}