Beispiel #1
0
        private void StartGame()
        {
            try
            {
                var dictonaryWords = new DictonaryWords()
                {
                    Language = Language
                };

                if (ListDictonaryWords == null)
                {
                    ListDictonaryWords = DictonaryManager.PrepareWordList(repository.GetRecords(), dictonaryWords);
                    if (ListDictonaryWords.Count < 4)
                    {
                        var toast = Toast.MakeText(this, "Please enter word. There is not enough WordList for starting game.", ToastLength.Short);
                        toast.Show();
                        LoadMain();
                        return;
                    }
                    GameResultCalculation.ElapsedStropWatch.Start();
                    var toast1 = Toast.MakeText(this, String.Format("Game started!!! {0}  Word", ListDictonaryWords.Count), ToastLength.Short);
                    toast1.Show();
                }

                VisibleClearForm(GameLevel);

                var RandomWords = DictonaryManager.PrepareWordList(repository.GetRecords(), dictonaryWords);

                switch (GameLevel)
                {
                case GameLevels.Easy:
                    ListButton = GenerateRandom(4);
                    break;

                case GameLevels.Medium:
                    ListButton = GenerateRandom(5);
                    break;

                case GameLevels.Hard:
                    ListButton = GenerateRandom(6);
                    break;
                }


                SetGuessWordButtons(RandomWords);
            }
            catch (Exception ex)
            {
                var toast = Toast.MakeText(this, ex.Message, ToastLength.Short);
                toast.Show();
            }
        }
Beispiel #2
0
        private void LoadList()
        {
            var dictonaryWords = new DictonaryWords()
            {
                Language = GetLanguage
            };

            ListDictonaryWords = DictonaryManager.PrepareWordList(repository.GetRecords(), dictonaryWords);

            if (ListDictonaryWords != null)
            {
                _dictonaryListAdapter = new DictonaryListAdapter(this.Activity, ListDictonaryWords.OrderBy(a => a.Language).ThenBy(b => b.Word).ThenBy(c => c.TranslatedWord).ToList());
                listView.Adapter      = _dictonaryListAdapter;
                ListCount.Text        = $"{ListDictonaryWords.Count} Word";
            }
        }