public override void Login(LoginConfig config) { var prompt = new CustomMessageBox { Caption = config.Title, Message = config.Message, LeftButtonContent = config.OkText, RightButtonContent = config.CancelText }; var txtUser = new PhoneTextBox { PlaceholderText = config.LoginPlaceholder, Text = config.LoginValue ?? String.Empty }; var txtPass = new PhonePasswordBox { PlaceholderText = config.PasswordPlaceholder }; var stack = new StackPanel(); stack.Children.Add(txtUser); stack.Children.Add(txtPass); prompt.Content = stack; prompt.Dismissed += (sender, args) => config.OnResult(new LoginResult( txtUser.Text, txtPass.Password, args.Result == CustomMessageBoxResult.LeftButton )); this.Dispatch(prompt.Show); }
public override void Login(LoginConfig config) { var context = this.getTopActivity(); var txtUser = new EditText(context) { Hint = config.LoginPlaceholder, InputType = InputTypes.TextVariationVisiblePassword, Text = config.LoginValue ?? String.Empty }; var txtPass = new EditText(context) { Hint = config.PasswordPlaceholder ?? "*" }; this.SetInputType(txtPass, InputType.Password); var layout = new LinearLayout(context) { Orientation = Orientation.Vertical }; txtUser.SetMaxLines(1); txtPass.SetMaxLines(1); layout.AddView(txtUser, ViewGroup.LayoutParams.MatchParent); layout.AddView(txtPass, ViewGroup.LayoutParams.MatchParent); Utils.RequestMainThread(() => { var dialog = new AlertDialog .Builder(this.getTopActivity()) .SetCancelable(false) .SetTitle(config.Title) .SetMessage(config.Message) .SetView(layout) .SetPositiveButton(config.OkText, (o, e) => config.OnResult(new LoginResult(txtUser.Text, txtPass.Text, true)) ) .SetNegativeButton(config.CancelText, (o, e) => config.OnResult(new LoginResult(txtUser.Text, txtPass.Text, false)) ) .Create(); dialog.Window.SetSoftInputMode(SoftInput.StateVisible); dialog.Show(); }); }
public override void Login(LoginConfig config) { UITextField txtUser = null; UITextField txtPass = null; if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) { var dlg = UIAlertController.Create(config.Title ?? String.Empty, config.Message, UIAlertControllerStyle.Alert); dlg.AddAction(UIAlertAction.Create(config.OkText, UIAlertActionStyle.Default, x => config.OnResult(new LoginResult(txtUser.Text, txtPass.Text, true)))); dlg.AddAction(UIAlertAction.Create(config.CancelText, UIAlertActionStyle.Default, x => config.OnResult(new LoginResult(txtUser.Text, txtPass.Text, false)))); dlg.AddTextField(x => { txtUser = x; x.Placeholder = config.LoginPlaceholder; x.Text = config.LoginValue ?? String.Empty; }); dlg.AddTextField(x => { txtPass = x; x.Placeholder = config.PasswordPlaceholder; x.SecureTextEntry = true; }); this.Present(dlg); } else { var dlg = new UIAlertView { AlertViewStyle = UIAlertViewStyle.LoginAndPasswordInput, Title = config.Title, Message = config.Message }; txtUser = dlg.GetTextField(0); txtPass = dlg.GetTextField(1); txtUser.Placeholder = config.LoginPlaceholder; txtUser.Text = config.LoginValue ?? String.Empty; txtPass.Placeholder = config.PasswordPlaceholder; dlg.AddButton(config.OkText); dlg.AddButton(config.CancelText); dlg.CancelButtonIndex = 1; dlg.Clicked += (s, e) => { var ok = ((int)dlg.CancelButtonIndex != (int)e.ButtonIndex); config.OnResult(new LoginResult(txtUser.Text, txtPass.Text, ok)); }; this.Present(dlg); } }
public override void Login(LoginConfig config) { UITextField txtUser = null; UITextField txtPass = null; UIApplication.SharedApplication.InvokeOnMainThread(() => { if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) { var dlg = UIAlertController.Create(config.Title ?? String.Empty, config.Message, UIAlertControllerStyle.Alert); dlg.AddAction(UIAlertAction.Create(config.OkText, UIAlertActionStyle.Default, x => config.OnResult(new LoginResult(txtUser.Text, txtPass.Text, true)))); dlg.AddAction(UIAlertAction.Create(config.CancelText, UIAlertActionStyle.Default, x => config.OnResult(new LoginResult(txtUser.Text, txtPass.Text, false)))); dlg.AddTextField(x => { txtUser = x; x.Placeholder = config.LoginPlaceholder; x.Text = config.LoginValue ?? String.Empty; }); dlg.AddTextField(x => { txtPass = x; x.Placeholder = config.PasswordPlaceholder; x.SecureTextEntry = true; }); this.Present(dlg); } else { var dlg = new UIAlertView { AlertViewStyle = UIAlertViewStyle.LoginAndPasswordInput, Title = config.Title, Message = config.Message }; txtUser = dlg.GetTextField(0); txtPass = dlg.GetTextField(1); txtUser.Placeholder = config.LoginPlaceholder; txtUser.Text = config.LoginValue ?? String.Empty; txtPass.Placeholder = config.PasswordPlaceholder; dlg.AddButton(config.OkText); dlg.AddButton(config.CancelText); dlg.CancelButtonIndex = 1; dlg.Clicked += (s, e) => { var ok = ((int)dlg.CancelButtonIndex != (int)e.ButtonIndex); config.OnResult(new LoginResult(txtUser.Text, txtPass.Text, ok)); }; dlg.Show(); } }); }
public override IDisposable Login(LoginConfig config) { var dlg = new CredentialDialog { //UserName = config.LoginValue ?? String.Empty, WindowTitle = config.Title, Content = config.Message, ShowSaveCheckBox = false }; //dlg.MainInstruction dlg.ShowDialog(); config.OnResult(new LoginResult( dlg.UserName, dlg.Password, true )); return(new DisposableAction(dlg.Dispose)); }
public override IDisposable Login(LoginConfig config) { UITextField txtUser = null; UITextField txtPass = null; var dlg = UIAlertController.Create(config.Title ?? String.Empty, config.Message, UIAlertControllerStyle.Alert); dlg.AddAction(UIAlertAction.Create(config.CancelText, UIAlertActionStyle.Cancel, x => config.OnResult(new LoginResult(txtUser.Text, txtPass.Text, false)))); dlg.AddAction(UIAlertAction.Create(config.OkText, UIAlertActionStyle.Default, x => config.OnResult(new LoginResult(txtUser.Text, txtPass.Text, true)))); dlg.AddTextField(x => { txtUser = x; x.Placeholder = config.LoginPlaceholder; x.Text = config.LoginValue ?? String.Empty; }); dlg.AddTextField(x => { txtPass = x; x.Placeholder = config.PasswordPlaceholder; x.SecureTextEntry = true; }); return(this.Present(dlg)); }
public override void Login(LoginConfig config) { var prompt = new CustomMessageBox { Caption = config.Title, Message = config.Message, LeftButtonContent = config.OkText, RightButtonContent = config.CancelText }; var txtUser = new PhoneTextBox { //PlaceholderText = config.LoginPlaceholder, Text = config.LoginValue ?? String.Empty }; var txtPass = new PasswordBox(); //var txtPass = new PhonePasswordBox { //PlaceholderText = config.PasswordPlaceholder //}; var stack = new StackPanel(); stack.Children.Add(txtUser); stack.Children.Add(txtPass); prompt.Content = stack; prompt.Dismissed += (sender, args) => config.OnResult(new LoginResult( txtUser.Text, txtPass.Password, args.Result == CustomMessageBoxResult.LeftButton )); this.Dispatch(prompt.Show); }