/// <summary> /// Event handler for when a user selects a server /// </summary> /// <param name="obj">The highlighted Field in the Listview. Used</param> /// <param name="e">Not used</param> void SelectionChanged(object sender, TomShane.Neoforce.Controls.EventArgs e) { form.Play.Enabled = true; string[] serverInfo = form.Items[form.SelectedIndex]; foreach (GameServerInfo server in serverList) { if (server.Name == serverInfo[0]) { selectedServer = server; } } }
/// <summary> /// Acts as an event handler for the "Join" button. This method is called when the user /// clicks on the button. /// </summary> /// <param name="obj">Access to the object clicked. Unused.</param> /// <param name="e">Event arguments. Unused.</param> void Play_Click(object sender, TomShane.Neoforce.Controls.EventArgs e) { if (selectedServer != null) { ServiceManager.StateManager.ChangeState(new LoadingScreenState(selectedServer)); } else { MessageBox.Show( ServiceManager.Game.Manager, MessageBox.MessageBoxType.ERROR, "No server has been selected.", "No server selected."); } }
/// <summary> /// Event response to the "cancel" button being clicked. /// </summary> /// <param name="sender">Object which sent the event. Unused.</param> /// <param name="e">Mouse properties saved during the event. Unused.</param> private void Cancel_Click(object sender, TomShane.Neoforce.Controls.EventArgs e) { Message = "Loading cancelled."; Value = 0; try { thread.Interrupt(); } catch (Exception ex) { ServiceManager.Game.Console.DebugPrint( "[ERROR] At LoadingScreenState#Cancel_Click(): {0}", ex.Message); } ServiceManager.StateManager.ChangeState <ServerListState>(); }
/// <summary> /// Acts as an event handler for the "Refresh" button. This method is called when the user /// clicks on the button. /// </summary> /// <param name="obj">Access to the object clicked. Unused.</param> /// <param name="e">Event arguments. Unused.</param> void Refresh_Click(object sender, TomShane.Neoforce.Controls.EventArgs e) { this.RefreshServerList(); }
/// <summary> /// Acts as an event handler for the "Back" button. This method is called when the user /// clicks on the button. The result of the action is that it switches to the /// tank list state. /// </summary> /// <param name="obj">Access to the object clicked. Unused.</param> /// <param name="e">Event arguments. Unused.</param> void Back_Click(object sender, TomShane.Neoforce.Controls.EventArgs e) { ServiceManager.StateManager.ChangeState <TankListState>(); }