How to add multiple users in LoginFlow - Xamarin system

前端 未结 1 1193
挽巷
挽巷 2021-01-28 01:19

I have sample xamarin forms solution. I wanted username and login functionality. I was doing some research and found nice example.

https://developer.xamarin.com/samples

相关标签:
1条回答
  • 2021-01-28 01:57

    create a dictionary with all of your user/password pairs in it

    Dictionary<string, string> Credentials = new Dictionary<string, string>()
        {
            { "user1", "pass" },
            { "user2", "pass" },
            { "user3", "pass" }
        };
    

    then when you want to check them

    public bool ValidateLogin(string user, string pass) 
    {
      return (Credentials.ContainsKey(user) && Credentials[user] == pass);
    }
    
    0 讨论(0)
提交回复
热议问题