Пример #1
0
        private void loadedpage(object sender, RoutedEventArgs e)
        {
            ResultatTreatment     rslt      = new ResultatTreatment();
            List <List <string> > listStats = rslt.readStats();


            if (listStats.Count < 1)
            {
                MessageBox.Show(langparser.finder().Error.FileUnreadable);
            }
            else
            {
                List <itemForList> itemList = new List <itemForList> {
                };

                for (int i = listStats.Count - 1; i >= 0; i--)
                {
                    List <string> list = listStats[i];

                    long timeDelta = long.Parse(list[4]) - long.Parse(list[3]);

                    itemList.Add(new itemForList
                    {
                        noms    = list[0],
                        scores  = Convert.ToInt32(list[1]),
                        vitesse = (decimal)(Convert.ToDecimal(list[1]) / (timeDelta / 1000 == 0 ? 1 : timeDelta / 1000)),
                        fautes  = Convert.ToInt32(list[2]),
                        temps   = timeDelta / 60000 + "min " + timeDelta / 1000 + "s " + timeDelta % 1000 + "ms"
                    });
                }
                statsDataGrid.ItemsSource = itemList;
            }
        }
Пример #2
0
        private void stopGame()
        {
            playGame = false;
            gameTimer.Stop();

            long time_finished = DateTimeOffset.Now.ToUnixTimeMilliseconds();

            ResultatTreatment rslt = new ResultatTreatment();

            if (rslt.appendStats(nameTextbox.Text, charCount, fault, time_start, time_finished))
            {
                MessageBox.Show(langparser.finder().Error.saveError);
            }

            historyKeyPressed1.Content   = "";
            historyKeyPressed2.Content   = "";
            historyKeyPressed3.Content   = "";
            historyKeyToPressed1.Content = "";
            historyKeyToPressed2.Content = "";
            historyKeyToPressed3.Content = "";
            previewError.Content         = "";
            historyLetters.Clear();
            textPreview.Content = "";
            charCount           = 0;
            fault                   = 0;
            timer_Count             = 0;
            nbCharText              = CHARTEXTMAXCOUT;
            timerShow.Content       = 0;
            showKeyPressed.Text     = null;
            charachterCount.Content = langparser.finder().Label.characters + " ";
            reloadText();

            textAlertMessage = langparser.finder().Alert.gameOver;
            dTimer.Start();



            new Stats().Show();
        }