Example #1
0
        /// <summary>
        /// Pokazuje rezultate koji su napravljeni na engleskom jeziku.
        /// </summary>
        private void btnEnglish_Click(object sender, EventArgs e)
        {
            LoadingHighscore();

            List <Highscore> englishHighscore = new List <Highscore>();

            foreach (Highscore score in SortedList)
            {
                if (score.language == false)
                {
                    englishHighscore.Add(score);
                }
            }
            if (englishHighscore.Count > 10)
            {
                using (dbTypingGameEntities baza = new dbTypingGameEntities())
                {
                    baza.Highscore.Attach(englishHighscore[englishHighscore.Count - 1]);
                    baza.Highscore.Remove(englishHighscore[englishHighscore.Count - 1]);
                    baza.SaveChanges();
                }
                englishHighscore.Remove(englishHighscore[englishHighscore.Count - 1]);
            }
            highscoreBindingSource.DataSource = englishHighscore;
        }
Example #2
0
        /// <summary>
        /// Pokazuje rezultate koji su napravljeni na hrvatskom jeziku.
        /// </summary>
        private void btnCroatian_Click(object sender, EventArgs e)
        {
            LoadingHighscore();

            List <Highscore> croatianHighscore = new List <Highscore>();

            foreach (Highscore score in SortedList)
            {
                if (score.language == true)
                {
                    croatianHighscore.Add(score);
                }
            }
            if (croatianHighscore.Count > 10)
            {
                using (dbTypingGameEntities baza = new dbTypingGameEntities())
                {
                    baza.Highscore.Attach(croatianHighscore[croatianHighscore.Count - 1]);
                    baza.Highscore.Remove(croatianHighscore[croatianHighscore.Count - 1]);
                    baza.SaveChanges();
                }
                croatianHighscore.Remove(croatianHighscore[croatianHighscore.Count - 1]);
            }
            highscoreBindingSource.DataSource = croatianHighscore;
        }
Example #3
0
 /// <summary>
 /// Gumb prilikom kojeg se usnimava rezultat.
 /// </summary>
 private void btnSave_Click(object sender, EventArgs e)
 {
     using (dbTypingGameEntities baza = new dbTypingGameEntities())
     {
         Highscore highscore = new Highscore
         {
             nickname = txtName.Text,
             CPM      = CPM,
             WPM      = WPM,
             language = Hrv,
         };
         baza.Highscore.Add(highscore);
         baza.SaveChanges();
     }
     Close();
 }