/// <summary> /// Gracefully exits the application /// </summary> public static void GracefulExit() { Log(logsrc, "Graceful exit triggered"); Log(logsrc, "Stopping STATS threads"); Stats.Stop(); Log(logsrc, "Stopping SYMBOL thread"); Symbols.Stop(); if (logf != null && logging) { Log(null, "------------------------------------------\n"); logf.Close(); } }
/// <summary> /// Connect button click /// </summary> private void btnConnct_Click(object sender, EventArgs e) { if (Stats.Running) { Program.Log(logsrc, "DISCONNECT"); // Stop threads Stats.Stop(); Symbols.Stop(); ResetUI(); if (Program.BigWindow.Visible) { Program.BigWindow.ResetUI(); } } else { Program.Log(logsrc, "CONNECT"); // Validate IP address IPAddress temp; if (!IPAddress.TryParse(textIP.Text, out temp)) { Program.Log(logsrc, string.Format("Invalid IP: {0}", textIP.Text)); 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(); }