public AccountProvider(Service service, bool useSafari)
            {
                if (useSafari && !service.SupportsAuthentication)
                {
                    throw new NotSupportedException(string.Format("{0} does not support authentication with Safari.", service.Title));
                }

                Service   = service;
                UseSafari = useSafari;
            }
            public AccountProvider(Service service, Action <UIViewController, bool, NSAction> presentAuthController)
            {
                if (!service.SupportsAuthentication)
                {
                    throw new NotSupportedException(string.Format("{0} does not support authentication with a controller.", service.Title));
                }

                Service = service;
                PresentAuthController = presentAuthController;
            }
        void Share(Xamarin.Social.Service service)
        {
            if (fileName == "" || 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;
                }

                System.Console.WriteLine(service.Title + " shared");

                // 4. Now save to the database for the MainScreen list
                var si = new Core.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);
        }
		internal ShareViewController (Service service, Item item, Action<ShareResult> completionHandler)
		{
			this.service = service;
			this.item = item;
			this.completionHandler = completionHandler;

			Title = NSBundle.MainBundle.LocalizedString (service.ShareTitle, "Title of Share dialog");
			
			View.BackgroundColor = UIColor.White;

			futureAccounts = service.GetAccountsAsync ();
		}
Exemple #5
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);
        }
		internal ShareViewController (Service service, Item item, Action<ShareResult> completionHandler)
		{
			this.service = service;
			this.item = item;
			this.completionHandler = completionHandler;

			Title = NSBundle.MainBundle.LocalizedString (service.ShareTitle, "Title of Share dialog");
			
			View.BackgroundColor = UIColor.White;

            if (UIDevice.CurrentDevice.CheckSystemVersion (7, 0))
                EdgesForExtendedLayout = UIRectEdge.None;

			futureAccounts = service.GetAccountsAsync ();
		}
 public Task <IEnumerable <Account> > GetAccounts()
 {
     if (UseSafari)
     {
         return(Service.GetAccountsWithBrowserAsync(SafariUrlHandler.Instance));
     }
     else if (PresentAuthController != null)
     {
         return(Service.GetAccountsWithAuthUIAsync(PresentAuthController));
     }
     else
     {
         return(Service.GetAccountsAsync());
     }
 }
        void Share(Xamarin.Social.Service service)
        {
            var plotview     = view.FindViewById <OxyPlot.XamarinAndroid.PlotView>(Resource.Id.plotview);
            var plotviewline = view.FindViewById <OxyPlot.XamarinAndroid.PlotView>(Resource.Id.plotviewline);

            Item item = new Item {
                Text = "Share Text Here",
            };

            Intent intent = service.GetShareUI((Activity)ParentContext, item, shareResult => {
                System.Console.WriteLine(shareResult);
            });

            StartActivity(intent);
        }
Exemple #9
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);
        }
Exemple #10
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);
        }
            public AccountProvider (Service service, bool useSafari)
            {
                if (useSafari && !service.SupportsAuthentication)
                    throw new NotSupportedException (string.Format ("{0} does not support authentication with Safari.", service.Title));

                Service = service;
                UseSafari = useSafari;
            }
            public AccountProvider (Service service, Action<UIViewController, bool, NSAction> presentAuthController)
            {
                if (!service.SupportsAuthentication)
                    throw new NotSupportedException (string.Format ("{0} does not support authentication with a controller.", service.Title));

                Service = service;
                PresentAuthController = presentAuthController;
            }
		public void Share (Service service, UITextView t)
		{
			Item item = new Item {
				Text = "I'm sharing great things using Xamarin!",
				Links = new List<Uri> {
					new Uri ("http://xamarin.com"),
				},
			};

			UIViewController vc = service.GetShareUI (item, shareResult => {
				dialog.DismissViewController (true, null);

				t.Text = service.Title + " shared: " + shareResult;
			});
			dialog.PresentViewController (vc, true, null);
		}
Exemple #14
0
 public Session (Service service, Account account)
 {
     Service = service;
     Account = account;
 }