void ReleaseDesignerOutlets() { if (LoginButton != null) { LoginButton.Dispose(); LoginButton = null; } if (LoginImageView != null) { LoginImageView.Dispose(); LoginImageView = null; } if (LoginLabel != null) { LoginLabel.Dispose(); LoginLabel = null; } if (NotNowButton != null) { NotNowButton.Dispose(); NotNowButton = null; } }
void ReleaseDesignerOutlets() { if (CallApiButton != null) { CallApiButton.Dispose(); CallApiButton = null; } if (LoginButton != null) { LoginButton.Dispose(); LoginButton = null; } if (LogoutButton != null) { LogoutButton.Dispose(); LogoutButton = null; } if (OutputText != null) { OutputText.Dispose(); OutputText = null; } if (RefreshButton != null) { RefreshButton.Dispose(); RefreshButton = null; } }
protected override async Task OnDisappearingAnimationBeginAsync() { var taskSource = new TaskCompletionSource <bool>(); var currentHeight = FrameContainer.Height; await Task.WhenAll( UsernameEntry.FadeTo(0), PasswordEntry.FadeTo(0), LoginButton.FadeTo(0)); FrameContainer.Animate("HideAnimation", d => { FrameContainer.HeightRequest = d; }, start: currentHeight, end: 170, finished: async(d, b) => { await Task.Delay(300); taskSource.TrySetResult(true); }); await taskSource.Task; }
void ReleaseDesignerOutlets() { if (ForgotPasswordButton != null) { ForgotPasswordButton.Dispose(); ForgotPasswordButton = null; } if (LoginButton != null) { LoginButton.Dispose(); LoginButton = null; } if (PasswordTextField != null) { PasswordTextField.Dispose(); PasswordTextField = null; } if (RegisterButton != null) { RegisterButton.Dispose(); RegisterButton = null; } if (UsernameTextField != null) { UsernameTextField.Dispose(); UsernameTextField = null; } }
void ReleaseDesignerOutlets() { if (CredentialsLabel != null) { CredentialsLabel.Dispose(); CredentialsLabel = null; } if (LoginButton != null) { LoginButton.Dispose(); LoginButton = null; } if (PasswordTextfield != null) { PasswordTextfield.Dispose(); PasswordTextfield = null; } if (UsernameTextfield != null) { UsernameTextfield.Dispose(); UsernameTextfield = null; } }
private void PasswordTextBox_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { LoginButton.PerformClick(); } }
private void SyncContent() { if (CurrentMode == Mode.Login) { LoginButton.SetText(isAuthenticating ? Resource.String.LoginButtonProgressText : Resource.String.LoginButtonText); LegalTextView.Visibility = ViewStates.Gone; GoogleLoginButton.SetText(Resource.String.LoginGoogleButtonText); } else { LoginButton.SetText(isAuthenticating ? Resource.String.LoginButtonSignupProgressText : Resource.String.LoginSignupButtonText); LegalTextView.SetText(FormattedLegalText, TextView.BufferType.Spannable); LegalTextView.MovementMethod = Android.Text.Method.LinkMovementMethod.Instance; LegalTextView.Visibility = ViewStates.Visible; GoogleLoginButton.SetText(Resource.String.LoginSignupGoogleButtonText); } LoginTabRadioButton.Enabled = !isAuthenticating; SignupTabRadioButton.Enabled = !isAuthenticating; TabsRadioGroup.Enabled = !isAuthenticating; EmailEditText.Enabled = !isAuthenticating; PasswordEditText.Enabled = !isAuthenticating; GoogleLoginButton.Enabled = !isAuthenticating; SyncLoginButton(); }
public AdminHomePage LoginAsAdmin(string login, string password) { LoginInput.SetValue(login); PasswordInput.SetValue(password); LoginButton.Click(); return(GoTo <AdminHomePage>()); }
void ReleaseDesignerOutlets() { if (CreateNewAccountLabel != null) { CreateNewAccountLabel.Dispose(); CreateNewAccountLabel = null; } if (EmailAddressInput != null) { EmailAddressInput.Dispose(); EmailAddressInput = null; } if (LoginButton != null) { LoginButton.Dispose(); LoginButton = null; } if (PasswordInput != null) { PasswordInput.Dispose(); PasswordInput = null; } }
private void prepareViews() { NavigationController.NavigationBarHidden = true; LoginButton.SetTitleColor( Foundation.MvvmCross.Helper.Color.Login.DisabledButtonColor.ToNativeColor(), UIControlState.Disabled ); EmailTextField.ShouldReturn += _ => { PasswordTextField.BecomeFirstResponder(); return(false); }; PasswordTextField.ShouldReturn += _ => { ViewModel.Login(); PasswordTextField.ResignFirstResponder(); return(false); }; View.AddGestureRecognizer(new UITapGestureRecognizer(() => { EmailTextField.ResignFirstResponder(); PasswordTextField.ResignFirstResponder(); })); prepareForgotPasswordButton(); ShowPasswordButton.SetupShowPasswordButton(); }
private void LoginTextBox_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { LoginButton.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } }
public void GivenILoginToAnyXeroOrganisation() { _driver.Navigate().GoToUrl(AppConfig.Url); UsernameTextBox.SendKeys(TestData.LoginDetails.Email); PasswordTextBox.SendKeys(TestData.LoginDetails.Password); LoginButton.Click(); }
protected override void OnElementChanged(ElementChangedEventArgs<Button> e) { base.OnElementChanged(e); if (e.OldElement != null || this.Element == null) { return; } loginButton = new LoginButton() { LoginBehavior = LoginBehavior.Native, }; loginButton.Completed += (sender, args) => { FacebookButton facebookButton = (FacebookButton)e.NewElement; FacebookEventArgs fbArgs = new FacebookEventArgs(); if (args.Result.Token != null) { fbArgs.UserId = args.Result.Token.UserID; fbArgs.AccessToken = args.Result.Token.TokenString; fbArgs.TokenExpiration = args.Result.Token.ExpirationDate.ToDateTime(); } facebookButton.Login(facebookButton, fbArgs); }; SetNativeControl(loginButton); }
private void InitializeAllStrings() { // login EmailTextField.Placeholder = Application.LocalizedString("EmailAddress"); PasswordTextField.Placeholder = Application.LocalizedString("Password"); LoginButton.SetTitle(Application.LocalizedString("Login"), UIControlState.Normal); WhatIsSeekiosButton.SetTitle(Application.LocalizedString("WhatIsSeekios"), UIControlState.Normal); // double action forget/create ForgetPasswordButton.SetTitle(Application.LocalizedString("ForgetPassword"), UIControlState.Normal); CreateAccountButton.SetTitle(Application.LocalizedString("CreateAccount"), UIControlState.Normal); BackButton.SetTitle(Application.LocalizedString("Back"), UIControlState.Normal); // createAccount FirstNameTextField.Placeholder = Application.LocalizedString("FirstName"); LastNameTextField.Placeholder = Application.LocalizedString("LastName"); PasswordTextFieldOfRegistration.Placeholder = Application.LocalizedString("Password"); ConfirmPasswordTextField.Placeholder = Application.LocalizedString("ConfirmPassword"); RegistrationButton.SetTitle(Application.LocalizedString("CreateMyAccount"), UIControlState.Normal); EmailTextFieldOfRegistration.Placeholder = Application.LocalizedString("EmailAddress"); ErrorMessageLabel.Text = Application.LocalizedString("PasswordErrorLength"); // forget Password EmailTextFieldOfForgetPassword.Placeholder = Application.LocalizedString("EmailAddress"); ResetPasswordButton.SetTitle(Application.LocalizedString("ResetPassword"), UIControlState.Normal); }
public static void LoginWithDefault() { Driver.CheckLocation(PageTypes.Login); UserName.FillInWith("testuser"); Password.FillInWith("password"); LoginButton.Click(); }
private void PassTextBox_KeyPress(object sender, KeyPressEventArgs K) { if (K.KeyChar == (char)Keys.Enter) { LoginButton.PerformClick();// LoginButton_Click(sender, null); } }
void ReleaseDesignerOutlets() { if (LoginButton != null) { LoginButton.Dispose(); LoginButton = null; } if (PasswordText != null) { PasswordText.Dispose(); PasswordText = null; } if (RegisterButton != null) { RegisterButton.Dispose(); RegisterButton = null; } if (UsernameText != null) { UsernameText.Dispose(); UsernameText = null; } }
void ReleaseDesignerOutlets() { if (CrmPassword != null) { CrmPassword.Dispose(); CrmPassword = null; } if (CrmUrl != null) { CrmUrl.Dispose(); CrmUrl = null; } if (CrmUsername != null) { CrmUsername.Dispose(); CrmUsername = null; } if (LoginButton != null) { LoginButton.Dispose(); LoginButton = null; } if (OutputText != null) { OutputText.Dispose(); OutputText = null; } }
private void LoginButton_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(UserTextBox.Text)) { MessageBox.Show("Enter the user name!"); } else if (string.IsNullOrEmpty(PasswordTextBox.Text)) { MessageBox.Show("Enter the Password!"); } else if (UserTextBox.Text == ("guest") && PasswordTextBox.Text == ("£123")) { films.Enabled = true; LoginButton.Hide(); LogoutButton.Show(); UserTextBox.Enabled = false; PasswordTextBox.Enabled = false; } else if ((UserTextBox.Text == ("Mike")) || (UserTextBox.Text == ("Jon")) && PasswordTextBox.Text == ("£456")) { films.Enabled = true; staff.Enabled = true; LoginButton.Hide(); LogoutButton.Show(); UserTextBox.Enabled = false; PasswordTextBox.Enabled = false; pictureStaff.Hide(); } else { WrongText.Text = "Wrong credentials"; UserTextBox.Text = string.Empty; PasswordTextBox.Text = string.Empty; } }
public void Login() { WebDriverWait wait = new WebDriverWait(Driver.Instance, new TimeSpan(0, 0, 20)); wait.Until(ExpectedConditions.ElementToBeClickable(By.ClassName("btnSignIn"))).Click(); // var wait5 = new WebDriverWait(Driver.Instance, new TimeSpan(0, 0, 10)); // wait5.Until(d => d.SwitchTo().ActiveElement().GetAttribute("Name") == "Login"); Driver.Wait(TimeSpan.FromSeconds(3)); IWebElement Email; Email = Driver.Instance.FindElement(By.Id("email")); Email.SendKeys(email); IWebElement Password; Password = Driver.Instance.FindElement(By.Id("password")); Password.SendKeys(password); Driver.Wait(TimeSpan.FromSeconds(3)); IWebElement LoginButton; LoginButton = Driver.Instance.FindElement(By.Id("loginButton")); LoginButton.Click(); Driver.Wait(TimeSpan.FromSeconds(4)); }
void ReleaseDesignerOutlets() { if (LoginButton != null) { LoginButton.Dispose(); LoginButton = null; } if (LoginFailedLabel != null) { LoginFailedLabel.Dispose(); LoginFailedLabel = null; } if (PasswordTextField != null) { PasswordTextField.Dispose(); PasswordTextField = null; } if (UsernameTextField != null) { UsernameTextField.Dispose(); UsernameTextField = null; } }
protected override async void OnAppearingAnimationEnd() { if (!IsAnimationEnabled) { return; } var translateLength = 400u; await Task.WhenAll( UsernameEntry.TranslateTo(0, 0, easing: Easing.SpringOut, length: translateLength), UsernameEntry.FadeTo(1), (new Func <Task>(async() => { await Task.Delay(200); await Task.WhenAll( PasswordEntry.TranslateTo(0, 0, easing: Easing.SpringOut, length: translateLength), PasswordEntry.FadeTo(1)); }))()); await Task.WhenAll( CloseImage.FadeTo(1), CloseImage.ScaleTo(1, easing: Easing.SpringOut), CloseImage.RotateTo(0), LoginButton.ScaleTo(1), LoginButton.FadeTo(1)); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.login_activity); //return base.OnOptionsItemSelected(item); FirebaseApp.InitializeApp(this); _auth = FirebaseAuth.Instance; GoogleButton = FindViewById <SignInButton>(Resource.Id.gButton); GoogleButton.Click += (object sender, System.EventArgs e) => { var signGoogleintent = Auth.GoogleSignInApi.GetSignInIntent(_googleApiClient); StartActivityForResult(signGoogleintent, Constants.ActionResult.GoogleLoginResul); }; FacebookButton = FindViewById <LoginButton>(Resource.Id.fButton); FacebookButton.SetReadPermissions("email", "public_profile"); callbackManager = CallbackManagerFactory.Create(); FacebookButton.RegisterCallback(callbackManager, this); _googleApiClient = LoginHelper.ConfigureGoogleSignIn(this); }
private void prepareViews() { NavigationController.NavigationBarHidden = true; LoginButton.SetTitleColor( UIColor.White.ColorWithAlpha((nfloat)0.5), UIControlState.Disabled ); EmailTextField.ShouldReturn += _ => { PasswordTextField.BecomeFirstResponder(); return(false); }; PasswordTextField.ShouldReturn += _ => { ViewModel.Login(); PasswordTextField.ResignFirstResponder(); return(false); }; setupKeyboardDismissingGestureRecognizers(); prepareForgotPasswordButton(); ShowPasswordButton.SetupShowPasswordButton(); }
void ReleaseDesignerOutlets() { if (ErrorLabel != null) { ErrorLabel.Dispose(); ErrorLabel = null; } if (LoginButton != null) { LoginButton.Dispose(); LoginButton = null; } if (PasswordTextField != null) { PasswordTextField.Dispose(); PasswordTextField = null; } if (RegisterButton != null) { RegisterButton.Dispose(); RegisterButton = null; } if (UsernameTextField != null) { UsernameTextField.Dispose(); UsernameTextField = null; } }
private void PasswordBox_PreviewKeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Return) { LoginButton.Focus(); } }
private void PasswordTextBox_KeyDown(object sender, KeyRoutedEventArgs e) { if (e.Key.Equals(Windows.System.VirtualKey.Enter)) { LoginButton.Focus(FocusState.Programmatic); } }
private void LoginTextKeyUp(object sender, System.Windows.Input.KeyEventArgs e) { if (e.Key == Key.Enter) { LoginButton.RaiseEvent(new RoutedEventArgs(System.Windows.Controls.Button.ClickEvent)); } }
/// <summary> /// Attempts to log in /// </summary> /// <returns>false if failed to log in, not if already logged in</returns> public bool LogIn() { Console.WriteLine("Logging in if can"); WebDriverWait wait = TestingConfig.GetWaitDriver(Driver); try { //if we are logged in we are done if (IsLoggedOut()) { return(false); } LoginButton.Click(); LogInPage loginpage = new LogInPage(Driver); Console.WriteLine("Navigating to login page"); wait.Until(dr => loginpage.LogoButton); loginpage.LogIn(); } catch (Exception e) { Console.WriteLine(e.ToString()); return(false); } return(true); }
private void RegisterButton_OnTouchUpInside(object sender, EventArgs args) { IsRegisterMode = !IsRegisterMode; Animate(0.5, () => { if (IsRegisterMode) { TitleLabel.Text = ConstantsHelper.Register; ConfirmPasswordLabel.Hidden = false; ConfirmPasswordTextField.Hidden = false; LoginButton.SetTitle(ConstantsHelper.Register, UIControlState.Normal); LoginButton.BackgroundColor = UIColor.FromRGB(111, 201, 84); QuestionLabel.Text = ConstantsHelper.AlreadyHaveAccountQuestion; RegisterButton.SetTitle(ConstantsHelper.Login, UIControlState.Normal); } else { TitleLabel.Text = ConstantsHelper.Login; ConfirmPasswordLabel.Hidden = true; ConfirmPasswordTextField.Hidden = true; LoginButton.SetTitle(ConstantsHelper.Login, UIControlState.Normal); LoginButton.BackgroundColor = UIColor.FromRGB(17, 117, 240); QuestionLabel.Text = ConstantsHelper.DontHaveAccountQuestion; RegisterButton.SetTitle(ConstantsHelper.Register, UIControlState.Normal); } }); }
void ReleaseDesignerOutlets() { if (ActivityIndicator != null) { ActivityIndicator.Dispose(); ActivityIndicator = null; } if (EmailText != null) { EmailText.Dispose(); EmailText = null; } if (LoginButton != null) { LoginButton.Dispose(); LoginButton = null; } if (PasswordText != null) { PasswordText.Dispose(); PasswordText = null; } }
public override void ViewDidLoad() { base.ViewDidLoad(); _loginButton = new LoginButton(new CGRect(80, 120, 220, 46)) { LoginBehavior = LoginBehavior.SystemAccount, ReadPermissions = _readPermissions.ToArray() }; _loginButton.Completed += (sender, e) => { if (e.Error != null) { Debug.WriteLine(e.Error.Description); return; } if (e.Result != null && e.Result.IsCancelled) { return; } var userId = String.Format("Facebook:{0}", e.Result.Token.UserID); Vm.LoginSuccss(userId); // Handle your successful login }; // Handle actions once the user is logged out _loginButton.LoggedOut += (sender, e) => { // Handle your logout }; View.Add(_loginButton); }
public override void ViewDidLoad() { base.ViewDidLoad(); loginButton = new LoginButton(new CGRect(80, 120, 220, 46)) { LoginBehavior = LoginBehavior.SystemAccount, ReadPermissions = readPermissions.ToArray() }; loginButton.Completed += (sender, e) => { if (e.Error != null) { Debug.WriteLine(e.Error.Description); } if (e.Result != null && e.Result.IsCancelled) { // Handle if the user cancelled the login request } // Handle your successful login }; // Handle actions once the user is logged out loginButton.LoggedOut += (sender, e) => { // Handle your logout nameLabel.Text = ""; }; // The user image profile is set automatically once is logged in pictureView = new ProfilePictureView(new CGRect(80, 200, 220, 220)); // Create the label that will hold user's facebook name nameLabel = new UILabel(new CGRect(20, 319, 280, 21)) { TextAlignment = UITextAlignment.Center, BackgroundColor = UIColor.Clear }; // If you have been logged into the app before, ask for the your profile name if (AccessToken.CurrentAccessToken != null) { var request = new GraphRequest("/me?fields=name", null, AccessToken.CurrentAccessToken.TokenString, null, "GET"); request.Start((connection, result, error) => { // Handle if something went wrong with the request if (error != null) { new UIAlertView("Error...", error.Description, null, "Ok", null).Show(); return; } // Get your profile name var userInfo = result as NSDictionary; nameLabel.Text = userInfo["name"].ToString(); }); } // Add views to main view View.AddSubview(loginButton); View.AddSubview(pictureView); View.AddSubview(nameLabel); // Perform any additional setup after loading the view, typically from a nib. ConfigureView(); }
public override void ViewDidLoad() { base.ViewDidLoad(); int height = AppDelegate.height; int width = AppDelegate.width; // If was send true to Profile.EnableUpdatesOnAccessTokenChange method // this notification will be called after the user is logged in and // after the AccessToken is gotten //UIImage bg = new UIImage("launch_screen.jpeg", 2f); //UIImageView bgImage = new UIImageView(bg); var bgImage = new UIImageView(UIImage.FromBundle("login_image.jpeg")); bgImage.Frame = new CoreGraphics.CGRect(-100, 0, ((float) bgImage.Image.CGImage.Width / (float) bgImage.Image.CGImage.Height) * (float)AppDelegate.height, AppDelegate.height); Facebook.CoreKit.Profile.Notifications.ObserveDidChange((sender, e) => { if (e.NewProfile == null) return; nameLabel.Text = e.NewProfile.Name; name = e.NewProfile.Name; logIn(width, height); }); b = UIButton.FromType(UIButtonType.System); b.SetTitle("Button!", UIControlState.Normal); b.TouchUpInside += (sender, e) => { System.Diagnostics.Debug.WriteLine("Lort"); }; // Set the Read and Publish permissions you want to get loginView = new LoginButton(new CGRect(width / 2 - (110), height / 1.5, 220, 46)) { LoginBehavior = LoginBehavior.Native, ReadPermissions = readPermissions.ToArray() }; // Handle actions once the user is logged in loginView.Completed += (sender, e) => { if (e.Error != null) { HowlOut.LoginPage.LoginCancel(); } if (e.Result.IsCancelled) { HowlOut.LoginPage.LoginCancel(); } token = e.Result.Token.TokenString; id = e.Result.Token.UserID; }; // Handle actions once the user is logged out loginView.LoggedOut += (sender, e) => { // Handle your logout }; UIButton continueBtn = new UIButton(new CGRect(width / 2 - 110, height / 1.25, 220, 46)); continueBtn.BackgroundColor = App.HowlOut.ToUIColor(); continueBtn.TintColor = App.HowlOut.ToUIColor(); continueBtn.SetTitle("log in with HowlOut", UIControlState.Normal); continueBtn.SetTitleColor(Color.White.ToUIColor(), UIControlState.Normal); continueBtn.TouchUpInside += (sender, e) => { LoginPage.HowlOutLogin(); }; // The user image profile is set automatically once is logged in pictureView = new ProfilePictureView(new CGRect(width / 2 - 110, 50, 220, 220)); // Create the label that will hold user's facebook name nameLabel = new UILabel(new RectangleF(width / 2 - 140, 319, 280, 21)) { TextAlignment = UITextAlignment.Center, BackgroundColor = UIColor.Clear }; // Add views to main view View.AddSubview(bgImage); UILabel header = new UILabel(new RectangleF(width / 2 - (110), height / 4f, 220, 100)); header.Text = "please log in"; header.TextColor = Color.White.ToUIColor(); header.TextAlignment = UITextAlignment.Center; header.Font = UIFont.FromName("Helvetica-Bold", 16); View.AddSubview(header); UILabel hoHeader = new UILabel(new RectangleF(width / 2 - (110), height / 5f, 220, 100)); hoHeader.Text = "HowlOut"; hoHeader.TextColor = Color.White.ToUIColor(); hoHeader.TextAlignment = UITextAlignment.Center; hoHeader.Font = UIFont.FromName("Helvetica-Bold", 40f); View.AddSubview(hoHeader); View.AddSubview(loginView); View.AddSubview(continueBtn); View.AddSubview(b); //hoHeader.AddSubview(pictureView); View.AddSubview(nameLabel); /* var query = string.Format("SELECT uid,name,pic_square FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1={0}) ORDER BY name ASC", "me()"); FacebookClient fb = new FacebookClient(userToken); fb.GetTaskAsync("fql", new { q = query }).ContinueWith(t => { if (!t.IsFaulted) { var result = (IDictionary<string, object>)t.Result; var data = (IList<object>)result["data"]; var count = data.Count; var message = string.Format("You have {0} friends", count); Console.WriteLine(message); foreach (IDictionary<string, object> friend in data) Console.WriteLine((string)friend["name"]); } }); */ }
public DVCLogIn () : base (UITableViewStyle.Grouped, null, true) { // If was sent true to Profile.EnableUpdatesOnAccessTokenChange method // this notification will be called once the user is logged in Profile.Notifications.ObserveDidChange ((sender, e) => { if (e.NewProfile != null) { Root.Add (new Section ("Hello " + e.NewProfile.Name) { new StringElement ("Actions Menu", () => { var dvc = new DVCActions (); NavigationController.PushViewController (dvc, true); }) { Alignment = UITextAlignment.Center } }); } }); // If you use Native login behavior, you will get all read and publish permisions // otherwise, set the Read and Publish permissions you want to get loginView = new LoginButton (new CGRect (51, 0, 218, 46)) { LoginBehavior = LoginBehavior.Native, // ReadPermissions = extendedPermissions, // PublishPermissions = publishPermissions }; // Handle actions once the user is logged in loginView.Completed += (sender, e) => { if (e.Error != null) { new UIAlertView ("Ups", e.Error.Description, null, "Ok", null).Show (); return; } }; // Handle actions once the user is logged out loginView.LoggedOut += (sender, e) => { if (Root.Count >= 3) { InvokeOnMainThread (() => { var section = Root [2]; section.Remove (0); Root.Remove (section); ReloadData (); }); } }; // The user image profile is set automatically once is logged in pictureView = new ProfilePictureView (new CGRect (50, 0, 220, 220)); Root = new RootElement ("Facebook Sample") { new Section () { new UIViewElement ("", loginView, true) { Flags = UIViewElement.CellFlags.DisableSelection | UIViewElement.CellFlags.Transparent, } }, new Section () { new UIViewElement ("", pictureView, true) { Flags = UIViewElement.CellFlags.DisableSelection | UIViewElement.CellFlags.Transparent, }, } }; }
static __InitializeAndroidActivity() { Console.WriteLine("StaticInvoke"); // Exception Ljava/lang/RuntimeException; thrown while initializing LTryHideActionbarExperiment/StaticInvoke; try { // https://groups.google.com/forum/?fromgroups=#!topic/android-developers/suLMCWiG0D8 var c = ScriptCoreLib.Android.ThreadLocalContextReference.CurrentContext; (ScriptCoreLib.Android.ThreadLocalContextReference.CurrentContext as ScriptCoreLib.Android.CoreAndroidWebServiceActivity).runOnUiThread( a => { //var c = ScriptCoreLib.Android.ThreadLocalContextReference.CurrentContext; // http://stackoverflow.com/questions/4451641/change-android-layout-programatically var sv = new ScrollView(a); var ll = new LinearLayout(a); //ll.setOrientation(LinearLayout.VERTICAL); sv.addView(ll); var b = new Button(a).AttachTo(ll); b.WithText("before AtClick"); b.AtClick( v => { b.setText("AtClick"); } ); var b2 = new Button(a); b2.setText("The other button!"); ll.addView(b2); //Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x7f050002 // at android.content.res.Resources.getText(Resources.java:230) // at android.content.res.Resources.getString(Resources.java:314) // at com.facebook.widget.LoginButton.setButtonText(LoginButton.java:532) // at com.facebook.widget.LoginButton.finishInit(LoginButton.java:472) // at com.facebook.widget.LoginButton.<init>(LoginButton.java:189) var login = new LoginButton(a); // You have disabled Facebook Login in your app, but you must still specify Package Name or Key Hashes. //login.loginText = "loginText"; login.setApplicationId("625051627510580"); // FATAL EXCEPTION: main //java.lang.NullPointerException: Argument 'applicationId' cannot be null // at com.facebook.internal.Validate.notNull(Validate.java:29) // at com.facebook.Session.<init>(Session.java:224) // at com.facebook.Session.<init>(Session.java:213) // at com.facebook.Session$Builder.build(Session.java:1454) // at com.facebook.widget.LoginButton$LoginClickListener.onClick(LoginButton.java:621) // FATAL EXCEPTION: main //com.facebook.FacebookException: Cannot use SessionLoginBehavior SSO_WITH_FALLBACK when com.facebook.LoginActivity is not declared as an activity in AndroidManifest.xml // at com.facebook.Session.validateLoginBehavior(Session.java:992) // at com.facebook.Session.open(Session.java:915) // at com.facebook.Session.openForRead(Session.java:385) // at com.facebook.widget.LoginButton$LoginClickListener.onClick(LoginButton.java:641) // Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f030001 //at android.content.res.Resources.getValue(Resources.java:1014) //at android.content.res.Resources.loadXmlResourceParser(Resources.java:2139) //at android.content.res.Resources.getLayout(Resources.java:853) //at android.view.LayoutInflater.inflate(LayoutInflater.java:394) //at android.view.LayoutInflater.inflate(LayoutInflater.java:352) //at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270) //at android.app.Activity.setContentView(Activity.java:1881) //at com.facebook.LoginActivity.onCreate(LoginActivity.java:55) login.setSessionStatusCallback( new XStatusCallback { yield = (arg0, arg1, arg2) => { var AccessToken = arg0.getAccessToken(); Console.WriteLine(new { AccessToken, arg0, arg1, arg2 }); } } ); login.setUserInfoChangedCallback( new XUserInfoChangedCallback { yield = u => { var id = u.getId(); var name = u.getName(); Console.WriteLine(new { name, id }); b2.WithText(new { name, id }.ToString()); } } ); login.AttachTo(ll); a.setContentView(sv); } ); } catch (Exception ex) { Console.WriteLine("error: " + new { ex.Message, ex.StackTrace }); } }
protected override void OnCreate (Bundle savedInstanceState) { base.OnCreate (savedInstanceState); uiHelper = new UiLifecycleHelper (this, callback); uiHelper.OnCreate (savedInstanceState); if (savedInstanceState != null) { string name = savedInstanceState.GetString (PENDING_ACTION_BUNDLE_KEY); pendingAction = (PendingAction)Enum.Parse (typeof(PendingAction), name); } SetContentView (Resource.Layout.main); loginButton = (LoginButton)FindViewById (Resource.Id.login_button); loginButton.UserInfoChangedCallback = new MyUserInfoChangedCallback (this); profilePictureView = FindViewById<ProfilePictureView> (Resource.Id.profilePicture); greeting = FindViewById<TextView> (Resource.Id.greeting); postStatusUpdateButton = FindViewById<Button> (Resource.Id.postStatusUpdateButton); postStatusUpdateButton.Click += delegate { OnClickPostStatusUpdate (); }; postPhotoButton = (Button)FindViewById (Resource.Id.postPhotoButton); postPhotoButton.Click += delegate { OnClickPostPhoto (); }; pickFriendsButton = (Button)FindViewById (Resource.Id.pickFriendsButton); pickFriendsButton.Click += delegate { OnClickPickFriends (); }; pickPlaceButton = (Button)FindViewById (Resource.Id.pickPlaceButton); pickPlaceButton.Click += delegate { OnClickPickPlace (); }; controlsContainer = (ViewGroup)FindViewById (Resource.Id.main_ui_container); FragmentManager fm = SupportFragmentManager; Fragment fragment = fm.FindFragmentById (Resource.Id.fragment_container); if (fragment != null) { // If we're being re-created and have a fragment, we need to a) hide the main UI controls and // b) hook up its listeners again. controlsContainer.Visibility = ViewStates.Gone; if (fragment is FriendPickerFragment) { SetFriendPickerListeners ((FriendPickerFragment)fragment); } else if (fragment is PlacePickerFragment) { SetPlacePickerListeners ((PlacePickerFragment)fragment); } } fm.BackStackChanged += delegate { if (fm.BackStackEntryCount == 0) { // We need to re-show our UI. controlsContainer.Visibility = ViewStates.Visible; } }; }
public override void ViewDidLoad () { base.ViewDidLoad (); // Perform any additional setup after loading the view, typically from a nib. // If was send true to Profile.EnableUpdatesOnAccessTokenChange method // this notification will be called after the user is logged in and // after the AccessToken is gotten Profile.Notifications.ObserveDidChange ((sender, e) => { if (e.NewProfile == null) return; nameLabel.Text = e.NewProfile.Name; }); // Set the Read and Publish permissions you want to get loginButton = new LoginButton (new CGRect (80, 20, 220, 46)) { LoginBehavior = LoginBehavior.Native, ReadPermissions = readPermissions.ToArray () }; // Handle actions once the user is logged in loginButton.Completed += (sender, e) => { if (e.Error != null) { // Handle if there was an error new UIAlertView ("Login", e.Error.Description, null, "Ok", null).Show (); return; } if (e.Result.IsCancelled) { // Handle if the user cancelled the login request new UIAlertView ("Login", "The user cancelled the login", null, "Ok", null).Show (); return; } // Handle your successful login new UIAlertView ("Login", "Success!!", null, "Ok", null).Show (); }; // Handle actions once the user is logged out loginButton.LoggedOut += (sender, e) => { // Handle your logout nameLabel.Text = ""; }; // The user image profile is set automatically once is logged in pictureView = new ProfilePictureView (new CGRect (80, 100, 220, 220)); // Create the label that will hold user's facebook name nameLabel = new UILabel (new CGRect (80, 340, 220, 21)) { TextAlignment = UITextAlignment.Center, BackgroundColor = UIColor.Clear }; // If you have been logged into the app before, ask for the your profile name if (AccessToken.CurrentAccessToken != null) { var request = new GraphRequest ("/me?fields=name", null, AccessToken.CurrentAccessToken.TokenString, null, "GET"); request.Start ((connection, result, error) => { // Handle if something went wrong with the request if (error != null) { new UIAlertView ("Error...", error.Description, null, "Ok", null).Show (); return; } // Get your profile name var userInfo = result as NSDictionary; nameLabel.Text = userInfo ["name"].ToString (); }); } // Add views to main view View.AddSubview (loginButton); View.AddSubview (pictureView); View.AddSubview (nameLabel); }
private void InitFacebookLogin() { LoginView.Hidden = false; Profile.Notifications.ObserveDidChange ((sender, e) => { if (e.NewProfile == null) return; LoginView.Hidden = true; LightBox.Hidden = true; nameLabel.Text = e.NewProfile.Name; }); CGRect viewBounds = LoginView.Bounds; // Set the Read and Publish permissions you want to get nfloat leftEdge = (viewBounds.Width - 220) /2; loginButton = new LoginButton (new CGRect (leftEdge, 60, 220, 46)) { LoginBehavior = LoginBehavior.Native, ReadPermissions = readPermissions.ToArray () }; // Handle actions once the user is logged in loginButton.Completed += (sender, e) => { if (e.Error != null) { // Handle if there was an error } if (e.Result.IsCancelled) { // Handle if the user cancelled the login request } // Handle your successful login FinalizeLogin(); }; // Handle actions once the user is logged out loginButton.LoggedOut += (sender, e) => { // Handle your logout nameLabel.Text = ""; }; // The user image profile is set automatically once is logged in pictureView = new ProfilePictureView (new CGRect (leftEdge, 140, 220, 220)); // Create the label that will hold user's facebook name nameLabel = new UILabel (new CGRect (20, 360, viewBounds.Width - 40, 21)) { TextAlignment = UITextAlignment.Center, BackgroundColor = UIColor.Clear }; // If you have been logged into the app before, ask for the your profile name if (AccessToken.CurrentAccessToken != null) { var request = new GraphRequest ("/me?fields=name", null, AccessToken.CurrentAccessToken.TokenString, null, "GET"); request.Start ((connection, result, error) => { // Handle if something went wrong with the request if (error != null) { new UIAlertView ("Error...", error.Description, null, "Ok", null).Show (); return; } // Get your profile name var userInfo = result as NSDictionary; nameLabel.Text = userInfo ["name"].ToString (); var controller = AppDelegate.ProfileController; this.NavigationController.PresentViewController(controller, true, null); }); } // Add views to main view LoginView.AddSubview (loginButton); LoginView.AddSubview (pictureView); LoginView.AddSubview (nameLabel); }
// public override void ViewDidLoad () // { // // } public override void ViewDidLoad() { Profile.Notifications.ObserveDidChange ((sender, e) => { if (e.NewProfile == null) return; nameLabel.Text = e.NewProfile.Name; }); // Set the Read and Publish permissions you want to get loginButton = new LoginButton (new CGRect (100, 100, 220, 46)) { LoginBehavior = LoginBehavior.Native, ReadPermissions = readPermissions.ToArray () }; // Handle actions once the user is logged in loginButton.Completed += (sender, e) => { if (e.Error != null) { // Handle if there was an error } if (e.Result.IsCancelled) { // Handle if the user cancelled the login request } // Handle your successful login }; // Handle actions once the user is logged out loginButton.LoggedOut += (sender, e) => { // Handle your logout nameLabel.Text = ""; }; // The user image profile is set automatically once is logged in pictureView = new ProfilePictureView (new CGRect (100, 160, 220, 220)); // Create the label that will hold user's facebook name nameLabel = new UILabel (new CGRect (100, 400, 280, 21)) { TextAlignment = UITextAlignment.Left, BackgroundColor = UIColor.Clear }; // If you have been logged into the app before, ask for the your profile name if (AccessToken.CurrentAccessToken != null) { var request = new GraphRequest ("/me/friends", null, AccessToken.CurrentAccessToken.TokenString, null, "GET"); request.Start ((connection, result, error) => { // Handle if something went wrong with the request if (error != null) { new UIAlertView ("Error...", error.Description, null, "Ok", null).Show (); return; } // Get your profile name var userInfo = result as NSDictionary; var friendlist = userInfo["data"]; var summary = userInfo["summary"]; }); } // Add views to main view View.AddSubview (loginButton); View.AddSubview (pictureView); View.AddSubview (nameLabel); }
public override void ViewDidLoad () { base.ViewDidLoad (); // Perform any additional setup after loading the view, typically from a nib. // If was send true to Profile.EnableUpdatesOnAccessTokenChange method // this notification will be called after the user is logged in and // after the AccessToken is gotten Profile.Notifications.ObserveDidChange ((sender, e) => { if (e.NewProfile == null) return; LoggedIn (e.NewProfile.UserID); }); loginButton = new LoginButton (new CGRect (48, 0, 218, 46)) { LoginBehavior = LoginBehavior.Native }; // Handle actions once the user is logged in loginButton.Completed += (sender, e) => { if (e.Error != null) { ShowMessageBox ("Ups", e.Error.Description, "Ok", null, null); return; } if (e.Result.IsCancelled) { ShowMessageBox ("Ups", "The user cancelled the request", "Ok", null, null); return; } }; // Handle actions once the user is logged out loginButton.LoggedOut += (sender, e) => { LoggedOut (); }; // This permission is set by default chkPublicProfile = new CustomCheckboxElement ("Public Profile", true); chkPublicProfile.Enabled = false; // Add or remove all the permissions that you want to ask readSection = new Section ("Ask Read Permissions") { chkPublicProfile, new CustomCheckboxElement ("Email", () => CheckReadPermission ("email")), new CustomCheckboxElement ("About Me", () => CheckReadPermission ("user_about_me")), new CustomCheckboxElement ("Birthday", () => CheckReadPermission ("user_birthday")), new CustomCheckboxElement ("Hometown", () => CheckReadPermission ("user_hometown")), new CustomCheckboxElement ("Friendlists", () => CheckReadPermission ("read_custom_friendlists")), new CustomCheckboxElement ("Managed Groups", () => CheckReadPermission ("user_managed_groups")) }; // The user image profile is set automatically once is logged in pictureView = new ProfilePictureView (new CGRect (48, 0, 220, 220)); // Add the initial sections Root = new RootElement ("Facebook iOS Sample") { readSection, new Section () { new UIViewElement ("", loginButton, true) { Flags = UIViewElement.CellFlags.DisableSelection | UIViewElement.CellFlags.Transparent, } } }; // If the user is already logged in, remove the read section and add the actions sections if (AccessToken.CurrentAccessToken != null) LoggedIn (AccessToken.CurrentAccessToken.UserID); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); _uiHelper = new UiLifecycleHelper (this, _callback); SetContentView (Resource.Layout.Login); _loginButton = (LoginButton)FindViewById (Resource.Id.login_button); _loginButton.UserInfoChangedCallback = new MyUserInfoChangedCallback (this); _loginButton.SetReadPermissions(new List<string>{"email"}); //_profilePictureView = FindViewById<ProfilePictureView> (Resource.Id.profilePicture); //_greeting = FindViewById<TextView> (Resource.Id.greeting); _mainLayoutView = FindViewById<LinearLayout> (Resource.Id.main_ui_container); _continueAnonymouslyButton = FindViewById<Button>(Resource.Id.btnNoLogin); _continueAnonymouslyButton.Click += (object sender, EventArgs e) => StartActivity (typeof (IntroActivity)); UpdateUI (); }