private void gameTimer_Tick(object sender, EventArgs e) { // && watch.Elapsed.TotalMilliseconds >= 500 //while (serialPort1.IsOpen) { try { int act = serialPort1.ReadChar(); if (act.Equals('w') && watch.Elapsed.TotalMilliseconds >= 500) { startScreen gameScreen = new startScreen(); gameScreen.Show(); //gameOn = true; watch.Restart(); //gameTimer.Stop(); //this.Close(); serialPort1.Close(); serialPort2.Close(); } else if (act.Equals('x') && watch.Elapsed.TotalMilliseconds >= 500) { help helpScreen = new help(); helpScreen.Show(); watch.Restart(); } //Thread.Sleep(500); } catch (Exception ex) { } }
private void startGame(object sender, EventArgs e) { //menuTheme.Stop(); startScreen gameScreen = new startScreen(); gameScreen.Show(); serialPort1.Close(); serialPort2.Close(); }