Exemple #1
0
        public LoginPage()
        {
            InitializeComponent();

            btnLogin.Clicked   += OnLoginClicked;
            btnSetting.Clicked += (sender, e) =>
            {
                Navigation.PushAsync(new ElsaSettingPage());
            };
            onLoading(false);

            NavigationPage.SetHasNavigationBar(this, false);

            if (LocalPreferences.IsPropertyExists("database"))
            {
                SettingVariable.Database = LocalPreferences.LoadApplicationProperty <string>("database");
            }

            if (LocalPreferences.IsPropertyExists("instance"))
            {
                SettingVariable.Instance = LocalPreferences.LoadApplicationProperty <string>("instance");
            }

            Debug.WriteLine("database instance" + SettingVariable.Database + " " + SettingVariable.Instance);
        }
Exemple #2
0
 bool isLoggedIn()
 {
     if (LocalPreferences.IsPropertyExists("isLoggedIn"))
     {
         return(LocalPreferences.LoadApplicationProperty <bool>("isLoggedIn"));
     }
     return(false);
 }
Exemple #3
0
        protected override async void OnAppearing()
        {
            if (isLoggedIn())
            {
                string usr = LocalPreferences.LoadApplicationProperty <string>("username");
                string pwd = LocalPreferences.LoadApplicationProperty <string>("password");

                entryUsername.Text = usr;
                entryPassword.Text = pwd;
                onLoading(true);
                bool valid = await Task.Run(() => validUser(usr, pwd));

                if (!valid)
                {
                    await DisplayAlert("Login failed", "Please check your username or password", "OK");

                    onLoading(false);
                    return;
                }
                loggingIn(usr, pwd);
            }
        }
Exemple #4
0
        void loadSavedSettings()
        {
            string database = "";

            if (LocalPreferences.IsPropertyExists(KEY_DB))
            {
                database = LocalPreferences.LoadApplicationProperty <string>(KEY_DB);
            }

            string instance = "";

            if (LocalPreferences.IsPropertyExists(KEY_INS))
            {
                instance = LocalPreferences.LoadApplicationProperty <string>(KEY_INS);
            }

            entryDatabase.Text = database;
            entryInstance.Text = instance;

            SettingVariable.Database = database;
            SettingVariable.Instance = instance;
        }