Ejemplo n.º 1
0
        /// <summary>
        /// Lancement au clique du bouton de connection
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        ///



        private void Connectbut_Click(object sender, EventArgs e)
        {
            string    login = Login.Text;
            string    port  = PortcomText.Text;
            string    pass  = password.Text;
            IPAddress ip    = ipadde;

            demarre.Connect(login, pass, port, ip);

            if (SimpleChatClient.Client.connectionState) //si l'état de la connection renvoi true
            {
                timerecieve.Start();                     //je lance le timer de réception
                IPText.Enabled       = false;
                PortcomText.Enabled  = false;
                Login.Enabled        = false;
                password.Enabled     = false;
                messageenvoi.Enabled = true;
                messageenvoi.Focus();
                listemess.BackColor = Color.DarkSeaGreen;
            }


            serveur = adresse.Text;
            based   = basebox.Text;
            id      = Idbox.Text;
            mdp     = passbox.Text;

            Tchatclient.Dao.DBConnection lance = new Tchatclient.Dao.DBConnection(serveur, based, id, mdp);
            //Tchatclient.Dao.DBConnection lance = new Tchatclient.Dao.DBConnection("CRM-UC-3616\\sqlexpress", "dlcdi_chat", "chatServer", "Cdi1234");

            lance.Open();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// fermeture de la connection et de l'application
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        private void Discobut_Click(object sender, EventArgs e)
        {
            demarre.Disconnect();

            serveur = adresse.Text;
            based   = basebox.Text;
            id      = Idbox.Text;
            mdp     = passbox.Text;
            Tchatclient.Dao.DBConnection lance = new Tchatclient.Dao.DBConnection(serveur, based, id, mdp);
            //Tchatclient.Dao.DBConnection lance = new Tchatclient.Dao.DBConnection("CRM-UC-3616\\sqlexpress", "dlcdi_chat", "chatServer", "Cdi1234");
            lance.Close();

            listemess.BackColor = Color.Crimson; //je remet le rouge de fon de fenêtre
            connectbut.Enabled  = true;
            timerecieve.Stop();                  //je lance le timer de réception
            IPText.Enabled      = true;
            PortcomText.Enabled = true;
            Login.Enabled       = true;
            password.Enabled    = true;

            this.Close();//je ferme la fenêtre
        }