private async void LanguagePicker_SelectedIndexChanged(object sender, EventArgs e) { if (LanguagePicker.SelectedIndex == 0) { Global.LanguageSelectedID = 0; Global.CheckLanguage(); setLanguage(); } else { Global.LanguageSelectedID = 1; Global.CheckLanguage(); setLanguage(); } var DefaultNumbers = new Saved_Settings() { StaticId = 1, Saved_Quantity = 10, Saved_Time = 90, LanguageId = Global.LanguageSelectedID, DownloadImages = true, }; await _connection.InsertOrReplaceAsync(DefaultNumbers); }
protected override async void OnAppearing() { _connection = DependencyService.Get <ISQLiteDb>().GetConnection(); await _connection.CreateTableAsync <Saved_Settings>(); var LoadNumbers = new Saved_Settings(); try { LoadNumbers = await _connection.GetAsync <Saved_Settings>(1); } catch (Exception) { var DefaultNumbers = new Saved_Settings() { StaticId = 1, Saved_Quantity = 10, Saved_Time = 90, LanguageId = 1, DownloadImages = true, }; await _connection.InsertOrReplaceAsync(DefaultNumbers); } LoadNumbers = await _connection.GetAsync <Saved_Settings>(1); Global.QuestionQuantity = LoadNumbers.Saved_Quantity; Global.CountDownTime = LoadNumbers.Saved_Time; Global.LanguageSelectedID = LoadNumbers.LanguageId; Global.DownloadImages = LoadNumbers.DownloadImages; enableButtons(); setLanguage(); base.OnAppearing(); }
protected override async void OnAppearing() { _connection = DependencyService.Get <ISQLiteDb>().GetConnection(); await _connection.CreateTableAsync <Saved_Settings>(); var LoadNumbers = new Saved_Settings(); try { LoadNumbers = await _connection.GetAsync <Saved_Settings>(1); } catch (Exception) { Global.LanguagePickerIndex = 0; LanguagePicker.Focus(); var DefaultNumbers = new Saved_Settings() { StaticId = 1, Saved_Quantity = 10, Saved_Time = 90, LanguageId = Global.LanguageSelectedID, DownloadImages = true, }; await _connection.InsertOrReplaceAsync(DefaultNumbers); } LoadNumbers = await _connection.GetAsync <Saved_Settings>(1); Global.QuestionQuantity = LoadNumbers.Saved_Quantity; Global.CountDownTime = LoadNumbers.Saved_Time; Global.LanguageSelectedID = LoadNumbers.LanguageId; Global.DownloadImages = LoadNumbers.DownloadImages; enableButtons(); setLanguage(); MessagingCenter.Send(this, Global.LanguageSelectedID.ToString()); //set double tap to exit toaster message language MessagingCenter.Send(this, "CanExit"); //enable double tap to exit base.OnAppearing(); }