Exemple #1
0
        public override void Login(LoginConfig config)
        {
            var vm = new LoginViewModel {
                LoginText           = config.OkText,
                Title               = config.Title,
                Message             = config.Message,
                UserName            = config.LoginValue,
                UserNamePlaceholder = config.LoginPlaceholder,
                PasswordPlaceholder = config.PasswordPlaceholder,
                CancelText          = config.CancelText
            };

            vm.Login = new Command(() =>
                                   config.OnResult?.Invoke(new LoginResult(vm.UserName, vm.Password, true))
                                   );
            vm.Cancel = new Command(() =>
                                    config.OnResult?.Invoke(new LoginResult(vm.UserName, vm.Password, false))
                                    );
            var dlg = new LoginContentDialog
            {
                DataContext = vm
            };

            this.Dispatch(() => dlg.ShowAsync());
        }
Exemple #2
0
        public override IDisposable Login(LoginConfig config)
        {
            var vm = new LoginViewModel
            {
                LoginText           = config.OkText,
                Title               = config.Title ?? String.Empty,
                Message             = config.Message ?? String.Empty,
                UserName            = config.LoginValue,
                UserNamePlaceholder = config.LoginPlaceholder,
                PasswordPlaceholder = config.PasswordPlaceholder,
                CancelText          = config.CancelText
            };

            vm.Login = new Command(() =>
                                   config.OnAction?.Invoke(new LoginResult(true, vm.UserName, vm.Password))
                                   );
            vm.Cancel = new Command(() =>
                                    config.OnAction?.Invoke(new LoginResult(false, vm.UserName, vm.Password))
                                    );
            var dlg = new LoginContentDialog
            {
                DataContext = vm
            };

            return(this.DispatchAndDispose(
                       //config.UwpSubmitOnEnterKey,
                       //config.UwpCancelOnEscKey,
                       () => dlg.ShowAsync(),
                       dlg.Hide
                       ));
        }
Exemple #3
0
        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)
        {
            return(this.Present(() =>
            {
                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?.Invoke(new LoginResult(false, txtUser.Text, txtPass.Text))));
                dlg.AddAction(UIAlertAction.Create(config.OkText, UIAlertActionStyle.Default, x => config.OnAction?.Invoke(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 dlg;
            }));
        }
        public override IDisposable Login(LoginConfig config) => this.Present(() =>
        {
            var alert = new NSAlert
            {
                AlertStyle      = NSAlertStyle.Informational,
                MessageText     = config.Title ?? string.Empty,
                InformativeText = config.Message ?? string.Empty
            };
            alert.AddButton(config.OkText);
            alert.AddButton(config.CancelText);

            var inputView = new NSStackView(new CGRect(0, 2, 200, 58));
            var txtUser   = new NSTextField(new CGRect(0, 28, 200, 24))
            {
                PlaceholderString = config.LoginPlaceholder,
                StringValue       = config.LoginValue ?? string.Empty
            };
            var txtPassword = new NSSecureTextField(new CGRect(0, 2, 200, 24))
            {
                PlaceholderString = config.PasswordPlaceholder
            };

            inputView.AddSubview(txtUser);
            inputView.AddSubview(txtPassword);

            alert.AccessoryView = inputView;
            alert.Layout();

            alert.BeginSheetForResponse(this.windowFunc(), result => config.OnAction?.Invoke(new LoginResult(result == 1000, txtUser.StringValue, txtPassword.StringValue)));
            return(alert);
        });
Exemple #6
0
        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);
        }
Exemple #7
0
        public virtual Task <LoginResult> LoginAsync(LoginConfig config)
        {
            var tcs = new TaskCompletionSource <LoginResult>();

            config.OnResult = x => tcs.TrySetResult(x);
            this.Login(config);
            return(tcs.Task);
        }
        public override IDisposable Login(LoginConfig config)
        {
            Entry textUser = new Entry()
            {
                Placeholder = config.LoginPlaceholder,
                Text        = config.LoginValue ?? String.Empty,
            };
            Entry textPass = new Entry
            {
                Placeholder = config.PasswordPlaceholder,
                IsPassword  = true,
            };
            var layout = new StackLayout
            {
                Children =
                {
                    textUser,
                    textPass,
                },
                Padding = 30
            };
            var positive = new XButton
            {
                Text = config.OkText
            };
            var negative = new XButton
            {
                Text = config.CancelText
            };
            var dialog = new Dialog()
            {
                Title            = config.Title,
                Subtitle         = config.Message,
                Content          = layout,
                HorizontalOption = LayoutOptions.Center,
                VerticalOption   = LayoutOptions.Center,
                Negative         = negative,
                Positive         = positive
            };

            dialog.OutsideClicked += (s, e) =>
            {
                dialog.Hide();
            };
            positive.Clicked += (s, e) =>
            {
                dialog.Hide();
                config.OnAction?.Invoke(new LoginResult(true, textUser.Text, textPass.Text));
            };
            negative.Clicked += (s, e) =>
            {
                dialog.Hide();
                config.OnAction?.Invoke(new LoginResult(false, textUser.Text, textPass.Text));
            };
            return(Show(dialog));
        }
        public override IDisposable Login(LoginConfig config)
        {
            var activity = this.TopActivityFunc();

            if (activity is AppCompatActivity act)
            {
                return(this.ShowDialog <LoginAppCompatDialogFragment, LoginConfig>(act, config));
            }

            return(this.Show(activity, () => new LoginBuilder().Build(activity, config)));
        }
        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();
                }
            });
        }
Exemple #11
0
        /// <summary> Gets login configuration. </summary>
        /// <exception cref="ArgumentNullException"> Thrown when one or more required arguments are null. </exception>
        /// <param name="config"> The configuration. </param>
        /// <returns> The login configuration. </returns>
        private AcrDialogs.LoginConfig GetLoginConfig(UserDialogLoginConfig config)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            var result = new AcrDialogs.LoginConfig();

            if (config.Title != null)
            {
                result.Title = config.Title;
            }
            if (config.Message != null)
            {
                result.Message = config.Message;
            }
            if (config.OkText != null)
            {
                result.OkText = config.OkText;
            }
            if (config.CancelText != null)
            {
                result.CancelText = config.CancelText;
            }
            if (config.LoginValue != null)
            {
                result.LoginValue = config.LoginValue;
            }
            if (config.LoginPlaceholder != null)
            {
                result.LoginPlaceholder = config.LoginPlaceholder;
            }
            if (config.PasswordPlaceholder != null)
            {
                result.PasswordPlaceholder = config.PasswordPlaceholder;
            }
            if (config.AndroidStyleId != null)
            {
                result.AndroidStyleId = config.AndroidStyleId;
            }
            if (config.OnAction != null)
            {
                result.OnAction = GetLoginResultAction(config.OnAction);
            }

            return(result);
        }
        public override IDisposable Login(LoginConfig config)
        {
            var activity = this.TopActivityFunc();

            if (activity is AppCompatActivity)
            {
                return(this.ShowDialog <LoginAppCompatDialogFragment, LoginConfig>((AppCompatActivity)activity, config));
            }

            if (activity is FragmentActivity)
            {
                return(this.ShowDialog <LoginDialogFragment, LoginConfig>((FragmentActivity)activity, config));
            }

            return(this.Show(activity, LoginBuilder.Build(activity, config)));
        }
        public virtual Task <LoginResult> LoginAsync(LoginConfig config, CancellationToken?cancelToken = null)
        {
            var tcs = new TaskCompletionSource <LoginResult>();

            config.OnResult = x => tcs.TrySetResult(x);

            var disp = this.Login(config);

            cancelToken?.Register(() =>
            {
                disp.Dispose();
                tcs.TrySetCanceled();
            });

            return(tcs.Task);
        }
        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);
            }
        }
Exemple #16
0
        public virtual async Task <LoginResult> LoginAsync(LoginConfig config, CancellationToken?cancelToken = null)
        {
            if (config.OnAction != null)
            {
                throw new ArgumentException(NO_ONACTION);
            }

            var tcs = new TaskCompletionSource <LoginResult>();

            config.OnAction = x => tcs.TrySetResult(x);

            var disp = this.Login(config);

            using (cancelToken?.Register(() => Cancel(disp, tcs)))
            {
                return(await tcs.Task);
            }
        }
        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 void Login(LoginConfig config) {
     var dlg = new LoginContentDialog();
     var vm = new LoginViewModel {
         LoginText = config.OkText,
         Title = config.Title,
         Message = config.Message,
         UserName = config.LoginValue,
         UserNamePlaceholder = config.LoginPlaceholder,
         PasswordPlaceholder = config.PasswordPlaceholder,
         CancelText = config.CancelText
     };
     vm.Login = new Command(() =>
         config.OnResult?.Invoke(new LoginResult(vm.UserName, vm.Password, true))
     );
     vm.Cancel = new Command(() =>
         config.OnResult?.Invoke(new LoginResult(vm.UserName, vm.Password, false))
     );
     dlg.DataContext = vm;
     this.Dispatch(() => dlg.ShowAsync());
 }
Exemple #19
0
        public virtual Task <LoginResult> LoginAsync(LoginConfig config, CancellationToken?cancelToken = null)
        {
            if (config.OnAction != null)
            {
                throw new ArgumentException(NO_ONACTION);
            }

            var tcs = new TaskCompletionSource <LoginResult>();

            config.OnAction = x => tcs.TrySetResult(x);

            var disp = this.Login(config);

            cancelToken?.Register(() =>
            {
                disp.Dispose();
                tcs.TrySetCanceled();
            });

            return(tcs.Task);
        }
Exemple #20
0
        public override IDisposable Login(LoginConfig config)
        {
            var txt   = new NSTextField(new CGRect(0, 0, 300, 20));
            var alert = new NSAlert
            {
                AccessoryView = txt,
                MessageText   = config.Message
            };

            alert.AddButton(config.OkText);
            if (config.CancelText != null)
            {
                alert.AddButton(config.CancelText);
            }

            var actionIndex = alert.RunModal();

            //config.OnAction?.Invoke(new LoginResult(actionIndex == 0, ));

            return(alert);
        }
        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);
        }
Exemple #22
0
 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 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);
        }
Exemple #24
0
 public override void Login(LoginConfig config)
 {
     throw new NotImplementedException();
 }
        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);
        }
Exemple #26
0
 public abstract IDisposable Login(LoginConfig config);
Exemple #27
0
 public override void Login(LoginConfig config)
 {
     throw new NotImplementedException();
 }
Exemple #28
0
 public override IDisposable Login(LoginConfig config)
 {
     throw new NotImplementedException();
 }
 public virtual Task<LoginResult> LoginAsync(LoginConfig config)
 {
     var tcs = new TaskCompletionSource<LoginResult>();
     config.OnResult = x => tcs.TrySetResult(x);
     this.Login(config);
     return tcs.Task;
 }
Exemple #30
0
 public abstract void Login(LoginConfig config);
 public override IDisposable Login(LoginConfig config)
 {
     var vm = new LoginViewModel
     {
         LoginText = config.OkText,
         Title = config.Title ?? String.Empty,
         Message = config.Message ?? String.Empty,
         UserName = config.LoginValue,
         UserNamePlaceholder = config.LoginPlaceholder,
         PasswordPlaceholder = config.PasswordPlaceholder,
         CancelText = config.CancelText
     };
     vm.Login = new Command(() =>
         config.OnAction?.Invoke(new LoginResult(true, vm.UserName, vm.Password))
     );
     vm.Cancel = new Command(() =>
         config.OnAction?.Invoke(new LoginResult(false, vm.UserName, vm.Password))
     );
     var dlg = new LoginContentDialog
     {
         DataContext = vm
     };
     return this.DispatchAndDispose(
         () => dlg.ShowAsync(),
         dlg.Hide
     );
 }
        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 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 abstract void Login(LoginConfig config);
 public override IDisposable Login(LoginConfig config)
 {
     throw new NotImplementedException ();
 }