private void timer1_Tick(object sender, EventArgs e) { timer1.Enabled = false; ILogger theLogger = new LoggerNLog(); theLogger.Log("timer1_Tick: Start"); Settings theSettings = Settings.Get(); IGroza theGroza = new GrozaFTP(theSettings.Groza_FTP_host, theSettings.Groza_FTP_user, theSettings.Groza_FTP_pass, theLogger); try { theLogger.Log("Groza: Access"); theGroza.Access(); } catch (Exception ex) { theLogger.Error(ex.Message); theLogger.Error(ex.StackTrace); } finally { timer1.Enabled = true; } }
static void FTP_connect() { Settings theSetting = Settings.Get(); try { ILogger theLogger = new LoggerConsole(); ILogger theLoggerNLog = new LoggerNLog(); IGroza theGrozaFTP = new GrozaFTP(theSetting.Groza_FTP_host, theSetting.Groza_FTP_user, theSetting.Groza_FTP_pass, theLoggerNLog); IGroza theGrozaDir = new GrozaDirectory("", theLogger); theGrozaFTP.Access(); } catch { Console.WriteLine("Ошибка"); } }