/// <summary> /// Connect button click /// </summary> private void btnConnct_Click(object sender, EventArgs e) { if (Stats.Running) { // Stop threads Stats.Stop(); Symbols.Stop(); ResetUI(); } else { // Validate IP address IPAddress temp; if (!IPAddress.TryParse(textIP.Text, out temp)) { MessageBox.Show(this, "Invalid IP address", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } // Save IP address Properties.Settings.Default.IP = textIP.Text; Properties.Settings.Default.Save(); // Set IPs Stats.IP = textIP.Text; Symbols.IP = textIP.Text; // Start threads Stats.Start(); Symbols.Start(); // Update UI textIP.Enabled = false; btnConnct.Text = "STOP"; btnConnct.ForeColor = Color.Red; } }
/// <summary> /// Gracefully exits the application /// </summary> public static void GracefulExit() { Console.WriteLine("Exiting..."); Stats.Stop(); Symbols.Stop(); }