public override IDisposable Login(LoginConfig config) { var prompt = new CustomMessageBox { Caption = config.Title, Message = config.Message, LeftButtonContent = config.OkText, RightButtonContent = config.CancelText }; var txtUser = new PhoneTextBox { Text = config.LoginValue ?? String.Empty }; var txtPass = new PasswordBox(); var stack = new StackPanel(); stack.Children.Add(txtUser); stack.Children.Add(txtPass); prompt.Content = stack; prompt.Dismissed += (sender, args) => config.OnAction(new LoginResult( args.Result == CustomMessageBoxResult.LeftButton, txtUser.Text, txtPass.Password )); return(this.DispatchWithDispose(prompt.Show, prompt.Dismiss)); }
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.OnAction(new LoginResult(false, txtUser.Text, txtPass.Text)))); dlg.AddAction(UIAlertAction.Create(config.OkText, UIAlertActionStyle.Default, x => config.OnAction(new LoginResult(true, txtUser.Text, txtPass.Text)))); 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 IDisposable Login(LoginConfig config) { Dispatch(() => { var loginControl = new LoginControl() { LoginValue = config.LoginValue }; FormsContentDialog dialog = new FormsContentDialog() { DataContext = config, Title = config.Title, Content = loginControl, IsPrimaryButtonEnabled = true, PrimaryButtonText = config.OkText, IsSecondaryButtonEnabled = true, SecondaryButtonText = config.CancelText }; dialog.PrimaryButtonClick += (s, e) => { HideContentDialog(); config.OnAction(new LoginResult(true, loginControl.LoginValue, loginControl.Password)); e.Cancel = true; }; dialog.SecondaryButtonClick += (s, e) => { HideContentDialog(); config.OnAction(new LoginResult(false, config.LoginValue, String.Empty)); e.Cancel = true; }; ShowContentDialog(dialog); }); return(new DisposableAction(HideContentDialog)); }
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.OnAction(new LoginResult( true, dlg.UserName, dlg.Password )); 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.OnAction(new LoginResult(false, txtUser.Text, txtPass.Text)))); dlg.AddAction(UIAlertAction.Create(config.OkText, UIAlertActionStyle.Default, x => config.OnAction(new LoginResult(true, txtUser.Text, txtPass.Text)))); 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 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.OnAction(new LoginResult( true, dlg.UserName, dlg.Password )); return new DisposableAction(dlg.Dispose); }
public override IDisposable Login(LoginConfig config) { var prompt = new CustomMessageBox { Caption = config.Title, Message = config.Message, LeftButtonContent = config.OkText, RightButtonContent = config.CancelText }; var txtUser = new PhoneTextBox { Text = config.LoginValue ?? String.Empty }; var txtPass = new PasswordBox(); var stack = new StackPanel(); stack.Children.Add(txtUser); stack.Children.Add(txtPass); prompt.Content = stack; prompt.Dismissed += (sender, args) => config.OnAction(new LoginResult( args.Result == CustomMessageBoxResult.LeftButton, txtUser.Text, txtPass.Password )); return this.DispatchWithDispose(prompt.Show, prompt.Dismiss); }