private void panel1_MouseUp(object sender, MouseEventArgs e) { if (dragging && !gameEnded) { //stop dragging and create step dragging = false; Point dropLocation = e.Location; Step clientStep = CreateValidMoveFromDragg(dropLocation); if (clientStep == null) { bottomLabelStr = unvalidStepStr; //update panel RefreshPanel(); return; } // valid client step bottomLabelStr = emptyStr; //update panel RefreshPanel(); //update game game.PerformStep(clientStep); //add step to db SaveStep(clientStep, Game.Player.Client.ToString()); //update panel RefreshPanel(); if (clientStep.EndGameResult != "") { EndGame(clientStep.EndGameResult); } else { // server turn game.Turn = Game.Player.Server.ToString(); topLabelStr = serverTurnStr; RefreshPanel(); //Thread.Sleep(2000); // to see server step //post step to server and get server step Step serverStep = getServerStep(clientStep); //update game game.PerformStep(serverStep); //add step to db SaveStep(serverStep, Game.Player.Server.ToString()); //update panel RefreshPanel(); if (serverStep.EndGameResult != "") { EndGame(serverStep.EndGameResult); } topLabelStr = clientTurnStr; RefreshPanel(); game.Turn = Game.Player.Client.ToString(); } } }