Example #1
0
 /// <summary>
 /// 异步地请求登录表单内容。
 /// </summary>
 /// <param name="form">需要登录的表单。</param>
 public static Task <bool> RequestAsync(ILoginField form)
 {
     return(Core.EnsureOnMainThread(async() =>
     {
         var viewModel = new LoginViewModel(form);
         viewModel.LoginCommand = new Command(viewModel.Login);
         viewModel.Page = new LoginPage(viewModel);
         await viewModel.Page.ShowAsync();
         return form.IsLogin;
     }));
 }
Example #2
0
 /// <summary>
 /// 对于表单请求登录。
 /// </summary>
 /// <param name="form">请求的表单。</param>
 /// <returns>登录是否成功。</returns>
 public static async Task <bool> RequestLogin(this ILoginField form)
 {
     if (form.AutoLogin && !form.IsLogin)
     {
         await form.Login();
     }
     if (!form.IsLogin)
     {
         await LoginViewModel.RequestAsync(form);
     }
     return(form.IsLogin);
 }
Example #3
0
 /// <summary>
 /// 创建登录视图模型,并绑定参数。
 /// </summary>
 /// <param name="form"></param>
 private LoginViewModel(ILoginField form)
 {
     Form  = form;
     Title = "登录" + form.FormName;
 }