Ejemplo n.º 1
0
        private void materialFlatButton2_Click(object sender, EventArgs e)
        {
            ScorecDb db = new ScorecDb();

            using (BrainStormerEntitiesS brdb = new BrainStormerEntitiesS())
            {
                var sc = new Score {
                    UserID = userName, Scores = score, TimePlayed = DateTime.Now
                };
                try
                {
                    brdb.Entry(sc).State = EntityState.Added;
                    brdb.SaveChanges();
                }
                catch (Exception)
                {
                    brdb.Entry(sc).State = EntityState.Modified;
                    brdb.SaveChanges();
                }
            }
            Hide();
            var wc = new WelcomScreen();

            wc.userName = userName;
            wc.score    = score.ToString();
            wc.Closed  += (s, args) => this.Close();
            wc.Show();
        }
Ejemplo n.º 2
0
 private void tickTime_Tick(object sender, EventArgs e)
 {
     if (ss != 0)
     {
         ss--;
         sec.Text = ss.ToString();
     }
     else if (ss == 0)
     {
         mm--;
         ss = 60;
         if (mm == 0)
         {
             tickTime.Stop();
             MessageBox.Show("Time Up GameOver");
             this.Hide();
             var wc = new WelcomScreen();
             wc.Closed += (s, args) => this.Close();
             wc.Show();
         }
         min.Text = mm.ToString();
     }
 }