/// <summary> /// Fires when cancel button is clicked /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void CancelButton_Click(object sender, EventArgs e) { Cancel = true; CancelButton.Enabled = false; GoButton.Enabled = true; if (timer != null) { timer.Stop(); } if (client != null && usertoken != null) { string json = "{ \"UserToken\":\"" + usertoken + "}"; HttpContent content = new StringContent(json, Encoding.UTF8, "application/json"); client.PutAsync("/BoggleService.svc/games/", content); } if (board != null) { board.Hide(); board = null; } usertoken = null; this.Show(); }
/// <summary> /// attempts to start game /// </summary> private void StartGame(object sender, EventArgs e) { HttpResponseMessage response = client.GetAsync("/BoggleService.svc/games/" + gameId).Result; string result = response.Content.ReadAsStringAsync().Result; if (result.Contains("active")) { timer.Stop(); board = new BoggleBoard(client, gameId, usertoken, this); board.Show(); } }