private void Sync_Load(object sender, EventArgs e) { notifyIcon1.BalloonTipText = "Application minimized"; notifyIcon1.BalloonTipTitle = "Liber B1 Sync"; //verificar se há conexao OpSQLlite sQLlite = new OpSQLlite(); //verifica se existe connexao connSAPLiber = new Connection(); //if (!connSAPLiber.hasConn) if (!sQLlite.ExistConn()) { button1.Enabled = false; button2.Enabled = false; toolStripStatusLabel3.BackColor = Color.Red; toolStripStatusLabel3.Text = "Sem Conexão."; label1TimeSAP.Text = "Temporizador não configurado"; label1.Text = ""; label2.Text = ""; label3.Text = ""; } else { toolStripStatusLabel3.BackColor = Color.Green; toolStripStatusLabel3.Text = "Conectado."; //verifica se existe configuração cfg = new Configuration(); if (sQLlite.ExistConf()) { if (cfg.TimeSAP < 2) { timer1.Enabled = false; } else { timer1.Interval = cfg.TimeSAP * 60 * 1000; } timer1.Start(); DateTime otherDate = DateTime.Now.AddMilliseconds(cfg.TimeSAP * 60 * 1000); label1TimeSAP.Text = otherDate.ToLongTimeString(); DateTime otherDate2 = DateTime.Now.AddMilliseconds(10 * 60 * 1000); label3.Text = otherDate2.ToLongTimeString(); MyLogger.Log("------------------------------------------------------------------------------------------------"); MyLogger.Log("Aguardando novas iterações..."); } else { label1TimeSAP.Text = "Temporizador não configurado"; label3.Text = ""; } } }
private void Form1_Load(object sender, EventArgs e) { OpSQLlite conn = new OpSQLlite(); if (conn.ExistConn()) { String key = "trugLk"; textBoxServerName.Text = conn.Getconnection(0); textBoxDBName.Text = conn.Getconnection(1); textBoxDBID.Text = conn.Getconnection(2); textBoxDBPass.Text = Cryptography.Decrypt(conn.Getconnection(3), key); textBoxSAPUser.Text = conn.Getconnection(4); textBoxSAPPass.Text = Cryptography.Decrypt(conn.Getconnection(5), key); textBoxLiberEnd.Text = conn.Getconnection(6); textBoxLiberUser.Text = conn.Getconnection(7); textBoxPassLiber.Text = Cryptography.Decrypt(conn.Getconnection(8), key); textBoxLiberPort.Text = conn.Getconnection(10); } conn.CloseConnection(); }