Esempio n. 1
0
 /// <summary>
 /// Creates the appropriate View Model for the selected View Type
 /// </summary>
 public ViewModelBase CreateVM(ViewType type)
 {
     return(type switch
     {
         ViewType.Login => _loginFactory.CreateVM(),
         ViewType.Home => _homeFactory.CreateVM(),
         ViewType.Customers => _customersFactory.CreateVM(),
         ViewType.Appointments => _appointmentsFactory.CreateVM(),
         ViewType.Addresses => _addressesFactory.CreateVM(),
         _ => throw new ArgumentException("View Type doesn't match a VM"),
     });
Esempio n. 2
0
    public async void Execute(object parameter)
    {
      if (!_loginVM.HasErrors)
      {
        bool? login = await _authService.Login(new LoginDTO(_loginVM.Username, _loginVM.Password));

        switch (login)
        {
          case false:
            _loginVM.Message = _loginVM.Info == "en" ?
              "Incorrect Username or Password" : "Identifiant ou mot de passe incorrect";
            break;
          case null:
            _loginVM.Message = _loginVM.Info == "en" ?
              "Database could not be reached" : "La base de données n'a pas pu être atteinte";
            break;
          case true:
            _loginVM.Message = _loginVM.Info == "en" ? "Success" : "Succès";
            _navigator.CurrentVM = _appointmentVMFactory.CreateVM();
            break;
        }
      }
    }