public override void Initialize() { CreatableTypes() .EndingWith("Service") .AsInterfaces() .RegisterAsLazySingleton(); Mvx.IoCProvider.RegisterSingleton(() => UserDialogs.Instance); RegisterAppStart <MainViewModel>(); DataBase.SetupConnection(); Task.Run(async() => { await DatabaseImages.UpdateData(); await DatabaseWords.UpdateData(); }); var assemblyConfig = new AssemblyContentConfig(GetType().GetTypeInfo().Assembly) { ResourceFolder = "Locales", ParserConfig = new ParserConfig { ThrowWhenKeyNotFound = true } }; var textProvider = new MvxYamlTextProvider(assemblyConfig); Mvx.IoCProvider.RegisterSingleton <IMvxTextProvider>(textProvider); Mvx.IoCProvider.RegisterSingleton <IMvxLocalizationProvider>(textProvider); }
private async Task Blitz(bool isImage) { Settings.TypeOfRepetition = TypeOfRepetitions.FourOptions; if (isImage) { var database = await DatabaseImages.GetDataNotLearned(); if (database.Count == 0) { Mvx.IoCProvider.Resolve <IMessageCore>().Toast(this["RepeatedAllImages"]); } else { await NavigationService.Navigate <BlitzPollViewModel, List <DatabaseImages> >(database); } } else { var database = await DatabaseWords.GetDataNotLearned(); if (database.Count == 0) { Mvx.IoCProvider.Resolve <IMessageCore>().Toast(this["RepeatedAllWords"]); } else { await NavigationService.Navigate <Languages.BlitzPollViewModel, List <DatabaseWords> >(database); } } }
private async Task NavigateToLearn() { if (DatabaseImages.DatabaseIsContain($"{DataBase.TableName}")) { var database = await DatabaseImages.GetDataNotLearned(); if (database.Count == 0) { Mvx.IoCProvider.Resolve <IMessageCore>().Toast(this["RepeatedAllImages"]); } else { await NavigationService.Navigate <LearnViewModel, List <DatabaseImages> >(database); } } else { var database = await DatabaseWords.GetDataNotLearned(); if (database.Count == 0) { Mvx.IoCProvider.Resolve <IMessageCore>().Toast(this["RepeatedAllWords"]); } else { await NavigationService.Navigate <Languages.LearnViewModel, List <DatabaseWords> >(database); } } }
private async Task GetDate() { var isContain = DatabaseImages.DatabaseIsContain($"{DataBase.TableName}"); LightColor = isContain ? Colors.Orange : Colors.Blue; DarkColor = isContain ? Colors.DarkOrange : Colors.DarkBlue; DataTupe = isContain ? $"{DataBase.TableName}" : "Words"; StatisticsDatabase = isContain ? await DBStatistics.GetImages($"{DataBase.TableName}") : await DBStatistics.GetWords($"{DataBase.TableName}"); }
private async Task NavigateToViewDictionaryViewModel() { if (DatabaseImages.DatabaseIsContain($"{DataBase.TableName}")) { await NavigationService.Navigate <ViewDictionaryViewModel>(); } else { await NavigationService.Navigate <Languages.ViewDictionaryViewModel>(); } }
public GeneralStatisticsViewModel() { Task.Run(async() => { Database = await DBStatistics.GetData($"{DataBase.TableName}"); var isContain = DatabaseImages.DatabaseIsContain($"{DataBase.TableName}"); DatabaseStats = isContain ? await DBStatistics.GetImages($"{DataBase.TableName}") : await DBStatistics.GetWords($"{DataBase.TableName}"); _avgTrueToday = await DBStatistics.AverageTrueToday($"{DataBase.TableName}"); _avgTrueMonth = await DBStatistics.AverageTrueMonth($"{DataBase.TableName}"); _avgTrue = await DBStatistics.AveragePercentTrue(Database); }).Wait(); }
public async void Button_Images_Learn_Next_Click(View v) { if (ViewModel.Count < ViewModel.Database.Count) { await DatabaseImages.UpdateLearningNext(ViewModel.Database[ViewModel.Count].Image_name); using (var image = BitmapFactory.DecodeStream( Application.Context.Assets.Open( $"Image{DataBase.TableName}/{ViewModel.Database[ViewModel.Count].Image_name}.png"))) using (var ImageViewBox = BitmapHelper.GetRoundedCornerBitmap(image, PixelConverter.DpToPX(5))) { FindViewById <ImageView>(Resource.Id.imageView_Images_learn).SetImageBitmap(ImageViewBox); } ViewModel.Text = ViewModel.Database[ViewModel.Count++].ImageName; } else { Toast.MakeText(this, ViewModel.ErrorDictionaryOver, ToastLength.Short).Show(); } }
private async Task NavigateToRepeat() { var isImage = DatabaseImages.DatabaseIsContain($"{DataBase.TableName}"); if (Settings.QuizEnable && Settings.BlitzEnable) { if (API.Statistics.Count != 0) { await Quiz(isImage); } else { if (Settings.TypeOfRepetition == TypeOfRepetitions.Blitz) { await Blitz(isImage); } else { await Quiz(isImage); } } } else if (Settings.QuizEnable) { await Quiz(isImage); } else { if (API.Statistics.Count != 0) { API.Statistics.Delete(); } await Blitz(isImage); } }
public async void Button_Images_Learn_NotRepeat_Click(View v) { await DatabaseImages.UpdateLearningNotRepeat(ViewModel.Text); Button_Images_Learn_Next_Click(null); }