예제 #1
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
                       ));
        }
예제 #2
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());
        }
예제 #3
0
 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());
 }
예제 #4
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(
         () => dlg.ShowAsync(),
         dlg.Hide
     );
 }