Example #1
0
        public async Task SendMessage()
        {
            if (!String.IsNullOrEmpty(_newMessage))
            {
                _newMessage = _newMessage.TrimEmptyTape().Trim();

                if (!String.IsNullOrEmpty(_newMessage))
                {
                    var message = new Message
                    {
                        Text        = _newMessage,
                        Author      = _applicationContext.CurrentUser,
                        DateCreated = DateTime.Now,
                        Id          = -1
                    };


                    _taskDispatcher.RunOnUIThread(() =>
                    {
                        Messages.Add(message);
                        ScrollToTheEnd(true);
                    });

                    var id = await this._chatService.SendMessage(message);

                    message.Id = id;
                }
            }
            NewMessage = string.Empty;
        }