예제 #1
0
        /// <summary>
        /// Salva/Serializa o arquivo de configuração
        /// </summary>
        private void SaveDbParam()
        {
            sri.Serialize(FileName, cfg);

            while (CfgHistorico.Count > 200)
            {
                CfgHistorico.RemoveAt(0);
            }

            sri.Serialize(FileNameHistorico, CfgHistorico);
        }
예제 #2
0
        private void apagarToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (lstConnections.SelectedIndex != -1)
            {
                string str = lstConnections.Items[lstConnections.SelectedIndex].ToString();

                for (int i = 0; i < CfgHistorico.Count; i++)
                {
                    if (str == CfgHistorico[i].ToString())
                    {
                        CfgHistorico.RemoveAt(i);
                        break;
                    }
                }

                lstConnections.Items.RemoveAt(lstConnections.SelectedIndex);
            }
        }
예제 #3
0
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            lstConnections.Items.Clear();
            if (textBox1.Text.Length != 0)
            {
                lstConnections.Items.AddRange(CfgHistorico.Where(q => q.ToString().ToUpper().Contains(textBox1.Text.ToUpper())).ToArray());

                /*for (int i = 0; i < lstConnections.Items.Count; i++)
                 * {
                 *  if (lstConnections.Items[i].ToString().ToUpper().Contains(textBox1.Text.ToUpper()))
                 *  {
                 *      lstConnections.SelectedIndex = i;
                 *  }
                 * }*/
            }
            else
            {
                lstConnections.Items.AddRange(CfgHistorico.ToArray());
            }
        }
예제 #4
0
        protected override void OnConfirm()
        {
            cfg.DbType = ((enmConnection)this.cmbTipo.SelectedIndex);
            cfg.Info.UseWindowsAuthentication = this.cbWindowsAutenticate.Checked;
            cfg.Info.Server           = this.txtServer.Text;
            cfg.Info.Database         = this.txtBanco.Text;
            cfg.Info.User             = this.txtUsuario.Text;
            cfg.Info.Password         = this.txtSenha.Text;
            cfg.Info.ConnectionString = this.txtConnectionString.Text;

            for (int i = 0; i < CfgHistorico.Count; i++)
            {
                if (CfgHistorico[i].ToString() == cfg.ToString())
                {
                    CfgHistorico.RemoveAt(i);
                    break;
                }
            }

            CfgHistorico.Add(cfg);

            SaveDbParam();
            base.OnConfirm();
        }
예제 #5
0
 private void apagarHistóricoToolStripMenuItem_Click(object sender, EventArgs e)
 {
     CfgHistorico.Clear();
     lstConnections.Items.Clear();
 }