private void SQLReconnectTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { { SQLRetries++; ConnectedToSQL = SqlInfo.StartUp(SQLIPAddress, SQLDatabase, SQLUsername, SQLPassword); if (!ConnectedToSQL) { insim.Send(255, "SQL connect attempt failed! Attempting to reconnect in ^310 ^8seconds!"); } else { insim.Send(255, "SQL connected after ^3" + SQLRetries + " ^8times!"); SQLRetries = 0; SQLReconnectTimer.Stop(); } } }
private void SQLReconnectTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { { SQLRetries++; ConnectedToSQL = SqlInfo.StartUp(SQLIPAddress, SQLDatabase, SQLUsername, SQLPassword); if (!ConnectedToSQL) { SQL_label.Text = "MySQL : NOT CONNECTED!"; MessageToAdmins("SQL connect attempt failed! Attempting to reconnect in ^310 ^8seconds!"); } else { SQL_label.Text = "MySQL : CONNECTED!"; MessageToAdmins("SQL connected after ^3" + SQLRetries + " ^8times!"); SQLRetries = 0; SQLReconnectTimer.Stop(); } } }
public void Form1_Load(object sender, EventArgs e) { try { Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US"); #region ' Timer ' SuperFast.Elapsed += new System.Timers.ElapsedEventHandler(SuperFast_Elapsed); SuperFast.Interval = 1; SuperFast.Enabled = true; System.Timers.Timer Payout = new System.Timers.Timer(); Payout.Elapsed += new System.Timers.ElapsedEventHandler(Payout_Timer); Payout.Interval = 3000; Payout.Enabled = true; // SQL timer SQLReconnectTimer.Interval = 10000; SQLReconnectTimer.Elapsed += new System.Timers.ElapsedEventHandler(SQLReconnectTimer_Elapsed); ConnectedToSQL = SqlInfo.StartUp(SQLIPAddress, SQLDatabase, SQLUsername, SQLPassword); if (!ConnectedToSQL) { insim.Send(255, "SQL connect attempt failed! Attempting to reconnect in 10 seconds!"); SQLReconnectTimer.Start(); } else { insim.Send(255, "SQL Connected!"); } #endregion } catch (Exception error) { { MessageBox.Show("" + error.Message, "AN ERROR OCCURED"); } } }