Esempio n. 1
0
 private void RetryConnectToDB(object sender, EventArgs e)
 {
     DataBaseOperations.InitConnectionToDB();
     if (DataBaseOperations.Connected)
     {
         TimerRetryConnectToDB.Close();
     }
 }
Esempio n. 2
0
 public void StartServer()
 {
     DataTableDependeces.InitializeDependences(new DependencesInitializer());
     DataBaseOperations.InitConnectionToDB();
     if (!DataBaseOperations.Connected)
     {
         // нужно добавить дефолт
         RetryConnectionTime = int.Parse(ConfigurationManager.AppSettings.Get("RetryConnectionTime"));
         Console.WriteLine(RetryConnectionTime);
         Console.Read();
         TimerRetryConnectToDB          = new Timer(RetryConnectionTime); // 1 min
         TimerRetryConnectToDB.Elapsed += RetryConnectToDB;
     }
     new Listener().StartListen();
 }