Example #1
0
        public GamePage(MainWindow win, bool asComp, string t)
        {
            this.asComp = asComp;
            win.asComp  = asComp;
            InitializeComponent();
            ParentWindowMain = win;
            WordsLoader wordsLoader = new WordsLoader(ParentWindowMain);

            if (!win.DisplayDictionaryErrors(wordsLoader.errorType))
            {
                game = new GameSession(wordsLoader.GetRandomWord(), true);
                BuildGamePage();
                ParentWindowMain.gameStarted   = true;
                ParentWindowMain.gamePageChild = this;
            }
            letterToGuessTextBlock.IsEnabled = false;

            /*cts = new System.Threading.CancellationTokenSource();
             * token = cts.Token;
             * task = new Task(() => { compGuess(); }, token);
             * task.Start();
             *
             * //if (cts.Token.IsCancellationRequested) return;
             * cts.Dispose();
             * cts = null;*/
            compGuess();
        }
Example #2
0
 private void AddWord(String word)
 {
     wordsFromDictionary.Add(new Word(word));
     WordsLoader.SortWordsByAlphabet(wordsFromDictionary);
     RefreshWordsList();
     ShowAddWordPopup();
 }
Example #3
0
        public GamePage(MainWindow win)
        {
            asComp = false;
            InitializeComponent();
            ParentWindowMain = win;
            WordsLoader wordsLoader = new WordsLoader(ParentWindowMain);

            if (!win.DisplayDictionaryErrors(wordsLoader.errorType))
            {
                game = new GameSession(wordsLoader.GetRandomWord());
                BuildGamePage();
                ParentWindowMain.gameStarted   = true;
                ParentWindowMain.gamePageChild = this;
            }
        }
Example #4
0
        public DictionaryWindow(MainWindow win)
        {
            InitializeComponent();
            mainWindow  = win;
            wordsLoader = new WordsLoader(this);
            if (!win.DisplayDictionaryErrors(wordsLoader.errorType))
            {
                List <Word> tempList = wordsLoader.GetWords();
                wordsFromDictionary = new List <Word>(tempList.Count());
                foreach (Word w in tempList)
                {
                    wordsFromDictionary.Add(w);
                }
                //wordsLoader.GetWords().Clo(wordsFromDictionary.ToArray());

                PrintExistingWordsList(wordsLoader.GetWords());
                this.ShowDialog();
            }
        }