Ejemplo n.º 1
0
        private void btn_Sent_Click(object sender, RoutedEventArgs e)
        {
            var isAuthenticated = _clientTcp.IsAuthenticated();

            if (!isAuthenticated || string.IsNullOrWhiteSpace(textSent.Text))
            {
                return;
            }

            var selectedConversation = (ConversationModel)listBox.SelectedItem;

            if (selectedConversation != null)
            {
                var message = new MessageEventArgsModel
                {
                    Text            = textSent.Text,
                    MessageType     = MessageType.ToAnotherClient,
                    ConversationId  = selectedConversation.Id,
                    ClientId        = _currentСlient.Id,
                    PostingDateTime = DateTime.Now
                };
                var messageId = _common.SaveMessage(message);
                message.Id = messageId;
                _clientTcp.SentMessage(message);
                textSent.Text = string.Empty;
            }
        }