Exemple #1
0
 public void BtnLoginClick()
 {
     if (connect(true))
     {
         this.Hide();
         INICIO ini = new INICIO(this);
         ini.Show();
         //this.Close();
     }
 }
Exemple #2
0
 private void Click_Contacto(object obj, EventArgs e)
 {
     INICIO.CargarMensajes(conversation);
 }
Exemple #3
0
        public void CreateMessage(Messaged message)
        {
            Padre.Controls.Add(nombreEmisor);
            Padre.Controls.Add(horaMensaje);
            Padre.Controls.Add(Mensajes);
            Padre.Controls.Add(Luz);

            // La perte del igual hay que cambiarla al Cambiar el Usuarios de lugar debe estar en INICIO.Usuarios

            nombreEmisor.Text = senderProfile.username;


            //Aqui va algo como Inicio.UsuarioActual
            //nombreEmisor.Text = mensaje.idUsuario.ToString();


            //mensaje.getUsuario().GetIdUsuario() == LOGIN.usuario.GetIdUsuario()
            if (message.senderProfile.idUser == Log.loggedUser.idUser)//if (mensaje.idUsuario == ChatUI.idUsuarioActual)
            {
                Luz.Image = Azul;
            }
            else
            {
                Luz.Image = Rosa;
            }

            //Luz.Width = 633;
            //Luz.Height = 30;
            Luz.Size     = new Size(430, 20);
            Luz.SizeMode = PictureBoxSizeMode.StretchImage;
            //Luz.BackColor = Padre.BackColor;


            Mensajes.AutoSize    = true;
            Mensajes.MaximumSize = new Size(widthSize, 1000);
            Mensajes.MinimumSize = new Size(widthSize, 0);

            Mensajes.BorderStyle = BorderStyle.None;
            Mensajes.Margin      = new Padding(6, 3, 3, 3);

            nombreEmisor.MaximumSize = new Size(widthSize, 50);
            nombreEmisor.MinimumSize = new Size(widthSize, 0);
            horaMensaje.MaximumSize  = new Size(40, 50);
            horaMensaje.MinimumSize  = new Size(40, 0);


            string mensajeemoteado = message.message;

            string[] mensajin = Regex.Split(mensajeemoteado, "%\r\n%");

            if (mensajin[0] == "-_ENCODED_-")
            {
                mensajeemoteado = INICIO.Base64Decode(mensajin[1]);
            }

            foreach (INICIO.Emote em in INICIO.emotes)
            {
                mensajeemoteado = mensajeemoteado.Replace(em.nombre, em.rtfformat);
            }
            int indaux = Mensajes.Rtf.LastIndexOf(@"\par");

            Mensajes.Rtf = Mensajes.Rtf.Insert(indaux, mensajeemoteado);

            //Posiciones Iniciales de los Objetos
            nombreEmisor.Location = new Point(XInicioChat, YInicioChat - nombreEmisor.Height - Luz.Height - Mensajes.Height);
            Luz.Location          = new Point(XInicioChat, nombreEmisor.Location.Y + nombreEmisor.Height);
            Mensajes.Location     = new Point(XInicioChat, nombreEmisor.Location.Y + nombreEmisor.Height + Luz.Height);


            //Correcto          mensaje.getUsuario().GetIdUsuario() == LOGIN.usuario.GetIdUsuario()
            if (message.idSender == Log.loggedUser.idUser)
            {
                //Si eres tu
                nombreEmisor.TextAlign = ContentAlignment.BottomRight;
                horaMensaje.TextAlign  = ContentAlignment.BottomLeft;
                //Mensajes.TextAlign = ContentAlignment.TopRight;
                horaMensaje.Location = new Point(XInicioChat, YInicioChat - nombreEmisor.Height - Luz.Height - Mensajes.Height);
            }
            else
            {
                //Si es algun otro de la conversacion
                nombreEmisor.TextAlign = ContentAlignment.BottomLeft;
                horaMensaje.TextAlign  = ContentAlignment.MiddleRight;
                horaMensaje.Location   = new Point(XInicioChat + widthSize - horaMensaje.Width, YInicioChat - nombreEmisor.Height - Luz.Height - Mensajes.Height);
                //Mensajes.TextAlign = ContentAlignment.TopLeft;
            }

            Mensajes.RightToLeft = RightToLeft.No;

            Mensajes.ReadOnly = true;

            nombreEmisor.Show();
            Mensajes.Show();
            horaMensaje.Show();
            Luz.Show();
            horaMensaje.BringToFront();
            Padre.Refresh();
        }