Exemplo n.º 1
0
        //---------------------------------------------------------
        private void SendMessage()
        {
            //TESTDBKEYOK
            if (m_txtToSend.Text.Trim() != "")
            {
                try
                {
                    if (m_nIdUtilisateurAutre < 0)
                    {
                        CFormAlerte.Afficher(I.T("Select a User |30064"), EFormAlerteType.Erreur);
                        return;
                    }
                    CDbKey keyDest = CSc2iWin32DataClient.ContexteCourant.GetKeyFromId <CDonneesActeurUtilisateur>(m_nIdUtilisateurAutre);
                    if (!CSessionClient.IsUserConnected(keyDest))
                    {
                        CFormAlerte.Afficher(m_lblUser.Text + " is not connected|30065", EFormAlerteType.Erreur);
                        return;
                    }
                    string strMes = m_txtToSend.Text.Replace("\r", " ");
                    strMes = strMes.Replace("\n", " ");

                    int?nIdEnvoyeur = CSc2iWin32DataClient.ContexteCourant.GetIdFromKey <CDonneesActeurUtilisateur>(CTimosApp.SessionClient.GetInfoUtilisateur().KeyUtilisateur);

                    CDonneeNotificationMessageInstantane message = new CDonneeNotificationMessageInstantane(
                        CTimosApp.SessionClient.IdSession,
                        nIdEnvoyeur.Value,
                        keyDest,
                        strMes);
                    CEnvoyeurNotification.EnvoieNotifications(new IDonneeNotification[] { message });
                    AddMessage(strMes, false);
                    m_txtToSend.Text = "";
                }
                catch
                {
                    CFormAlerte.Afficher("Sending error|30066", EFormAlerteType.Erreur);
                }
            }
        }