public MoveFilesService() { try { try { path = ConfigurationManager.AppSettings["ConfigDirectory"] != null ? ConfigurationManager.AppSettings["ConfigDirectory"].ToString() : ""; } catch (Exception ePath) { path = ""; Log.EscribeLog("Error al obtener el path desde appSettings: " + ePath.Message); } if (File.Exists(path + "info.xml")) { _conf = XMLConfigurator.getXMLfile(); id_Servicio = _conf.id_Sitio; AETitle = _conf.vchAETitle; vchPathRep = _conf.vchPathLocal; vchClaveSitio = _conf.vchClaveSitio; } cargaServicio(); } catch (Exception eSync) { Log.EscribeLog("Existe un error en MoveFilesService: " + eSync.Message); } }
public MainWindow() { try { InitializeComponent(); _configura = new Entidades.clsConfiguracion(); //ConfigDA = new ConfiguracionDataAccess(); //tbl_ConfigSitio _config = new tbl_ConfigSitio(); //string mensaje = ""; if (File.Exists(path + "info.xml")) { _configura = XMLConfigurator.getXMLfile(); if (_configura != null) { if (_configura.vchClaveSitio != "") { txtSitio.Text = _configura.vchClaveSitio; txtSitio.IsEnabled = false; } else { // SitioName site = new SitioName(); // site.Show(); // this.Close(); txtSitio.IsEnabled = true; } } } else { txtSitio.IsEnabled = true; // string mensaje = ""; // bool existe = ConfigDA.getVerificaSitio(txtSitio.Text, ref mensaje); // if (existe) // { // tbl_ConfigSitio mdl = new tbl_ConfigSitio(); // ConfigDA.getConfiguracion(txtSitio.Text, ref mensaje); // } } } catch (Exception eMW) { MessageBox.Show("Existe un error al iniciar la aplicación: " + eMW.Message); } }
private void cargarTimmer() { try { try { path = ConfigurationManager.AppSettings["ConfigDirectory"] != null ? ConfigurationManager.AppSettings["ConfigDirectory"].ToString() : ""; } catch (Exception ePath) { path = ""; Log.EscribeLog("Error al obtener el path desde appSettings: " + ePath.Message); } try { Logpath = ConfigurationManager.AppSettings["LogDirectory"] != null ? ConfigurationManager.AppSettings["LogDirectory"].ToString() : ""; } catch (Exception ePath) { Logpath = ""; Log.EscribeLog("Error al obtener el path desde Log: " + ePath.Message); } if (File.Exists(path + "info.xml")) { _conf = XMLConfigurator.getXMLfile(); id_Servicio = _conf.id_Sitio; AETitle = _conf.vchAETitle; vchPathRep = _conf.vchPathLocal; vchClaveSitio = _conf.vchClaveSitio; } Console.WriteLine("Se cargó correctamente el servicio SenderFeed2SCUService. " + "[" + DateTime.Now.ToShortDateString() + DateTime.Now.ToShortTimeString() + "]"); Log.EscribeLog("Se cargó correctamente el servicio SenderFeed2SCUService. "); int segundosPoleo; try { segundosPoleo = ConfigurationManager.AppSettings["segundosPoleo"] != null?Convert.ToInt32(ConfigurationManager.AppSettings["segundosPoleo"].ToString()) : 1; } catch (Exception eGPOLeo) { Log.EscribeLog("Existe un error al obtener el tiempo para el poleo del servicio: " + eGPOLeo.Message); segundosPoleo = 1; } int minutos = (int)(1000 * segundosPoleo); SenderTimer.Elapsed += new System.Timers.ElapsedEventHandler(SenderTimer_Elapsed); SenderTimer.Interval = minutos; SenderTimer.Enabled = true; SenderTimer.Start(); try { NapoleonSenderDataAccess.setService(id_Servicio, vchClaveSitio); } catch (Exception setSer) { Log.EscribeLog("Existe un error en setService: " + setSer.Message); } } catch (Exception eCS) { Log.EscribeLog("Existe un error en cargarServicio: " + eCS.Message); } }