예제 #1
0
        /// <summary>
        /// Send message, mark all as read
        /// </summary>
        private async void OnTextCompleted(object?sender = null, EventArgs?args = null)
        {
            var text = popupEntryView.Text;

            if (string.IsNullOrEmpty(text))
            {
                return;
            }

            popupEntryView.Completed   -= OnTextCompleted;
            activityIndicator.IsVisible = true;

            await dialogsManager.SetDialogAndMessagesReadAndPublish(dialogId);

            await NetExceptionCatchHelpers.CatchNetException(
                async() =>
            {
                await messagesManager.SendMessage(dialogId, text, null);
                popupEntryView.Text = string.Empty;
            },
                () =>
            {
                OnTextCompleted();
                return(Task.CompletedTask);
            },
                LocalizedStrings.SendMessageNoInternetError);

            activityIndicator.IsVisible = false;
            popupEntryView.Completed   += OnTextCompleted;
        }
예제 #2
0
        private async void OnSendButtonPressed(object sender, EventArgs e)
        {
            if (voiceMessageTempPath == null)
            {
                return;
            }

            activityIndicator.IsVisible = true;

            await NetExceptionCatchHelpers.CatchNetException(
                async() =>
            {
                sendButton.IsEnabled = false;
                await messagesManager.SendMessage(dialogId, null, voiceMessageTempPath);
                DeleteTempFile();
                await Navigation.PopAsync();
            },
                () =>
            {
                OnSendButtonPressed(sender, e);
                return(Task.CompletedTask);
            },
                LocalizedStrings.SendMessageNoInternetError);

            activityIndicator.IsVisible = false;
            sendButton.IsEnabled        = true;
        }
예제 #3
0
        public void SendMessage(string ID, string FullName, string message)
        {
            ErrorEnum error;
            var       userModel = UserManager.RetrieveUser(new Guid(User.Identity.Name), out error);

            if (userModel == null)
            {
                userModel = UserManager.RetrieveUser(new Guid(User.Identity.Name), out error);
            }
            MessagesManager.SendMessage(userModel.ID.ToString(), userModel.FullName, FullName, ID, message);
        }