Пример #1
0
        private async Task LoadRemoteSetting()
        {
            if (entry_Login.Text.Length != 0 && entry_Password.Text.Length != 0)
            {
                // take data from Entry's and call webAPI method
                _rider = await LoadRiderDataFromAPI(entry_Login.Text, entry_Password.Text);


                if (_rider != null)
                {
                    var jsonData = JsonConvert.SerializeObject(_rider);

                    WriteSettingsAsync(jsonData);

                    await UpdateBindingContext(_rider);

                    PagePopping?.Invoke(this, new ModalPoppingEventArgs(this));

                    await OpenMainPage();
                }
                else
                {
                    // drop bad inits label
                }
            }
            else
            {
                // to do
                // we can drop warning label somewhere
            }
        }
Пример #2
0
        private async Task LoadLocalSettings()
        {
            if (File.Exists(accSettingPath))
            {
                try
                {
                    var settingsStr = await ReadSettingsAsync();

                    var rider = JsonConvert.DeserializeObject <RiderAccount>(settingsStr);

                    entry_Login.Text = rider.Login; entry_Password.Text = rider.Password;

                    //var loadTask = await LoadRiderDataFromAPI(rider.Login, rider.Password);

                    await UpdateBindingContext(rider);

                    PagePopping?.Invoke(this, new ModalPoppingEventArgs(this));
                    await OpenMainPage();
                }
                catch (Exception)
                {
                    Console.WriteLine("Exception in ctor");
                }
            }
        }