void TryLoginAndWatch(UIButton button, ServiceManager service, Action <UIViewController, bool, NSAction> presentAuthController = null) { UpdateLabel(button, service); service.StateChanged += (sender, e) => UpdateLabel(button, service); button.TouchUpInside += (sender, e) => { switch (service.State) { case SessionState.LoggedIn: case SessionState.Authenticating: service.CloseSession(); service.DeleteStoredAccounts(); break; case SessionState.LoggedOut: var choiceUI = new ActionSheetChoiceProvider <Account> (button.Frame, View); service.GetSessionAsync(LoginOptions.WithUIAndChoice(choiceUI, presentAuthController: presentAuthController)); break; } }; try { service.GetSessionAsync(LoginOptions.NoUI); } catch (UriFormatException) { Console.WriteLine("Open Services.cs and specify your API keys for each provider."); return; } }
public override void ViewDidLoad() { base.ViewDidLoad(); loginButton.TouchUpInside += (sender, e) => GetProfileAndFriendsAsync( LoginOptions.WithUIAndChoice(new ActionSheetChoiceProvider <Account> (loginButton.Frame, View)) ); }
public override void ViewDidLoad() { base.ViewDidLoad(); getRootButton.TouchUpInside += (sender, e) => GetRootFolder(LoginOptions.WithUIAndChoice(presentAuthController: PresentViewController)); OnStateChanged(Services.Dropbox.State); Services.Dropbox.StateChanged += (sender, e) => OnStateChanged(Services.Dropbox.State); }