void RecDialog_OnFinishRecording(object sender, StringEventArgs e)
        {
            if (!string.IsNullOrEmpty(e.FilePath) && CrossConnectivity.Current.IsConnected)
            {
                var filePath = ChatDetailViewUtils.SetNewFileNameOfVoice(e.FilePath);
                ViewModel.AudioFileToBeSent.Add(filePath);

                var model = new AddGroupChatHistoryItemRequest()
                {
                    SENDER_ID   = GetMyUserId(),
                    SENDER_NAME = GetMyUserName(),
                    GROUP_ID    = ViewModel.CurrentlyOpenDTO.GROUP_ID,
                    MSG_TYPE    = GlobalConstants.CHAT_HISTORY_ITEM_AUDIO,
                    MSG_CONTENT = txtContent.Text.Trim(),
                };

                var bArray       = File.ReadAllBytes(filePath);
                var fileName     = Path.GetFileName(filePath);
                var requestModel = new AddGroupVoiceMessageItemRequest()
                {
                    FilebArray  = bArray,
                    FileName    = fileName,
                    ItemRequest = model
                };
                ViewModel.SendVoiceMessageCommand.Execute(requestModel);
            }
        }
Beispiel #2
0
 void RecDialog_OnFinishRecording(object sender, StringEventArgs e)
 {
     if (!string.IsNullOrEmpty(e.FilePath) && CrossConnectivity.Current.IsConnected)
     {
         var filePath = ChatDetailViewUtils.SetNewFileNameOfVoice(e.FilePath);
         ViewModel.AudioFileToBeSent.Add(filePath);
         var ItemModel = new AddPrivateChatHistoryItemRequest()
         {
             SENDER_ID     = ViewModel.CurrentlyOpenDTO.MyUserId,
             OTHER_USER_ID = ViewModel.CurrentlyOpenDTO.OtherUserId,
             MSG_TYPE      = GlobalConstants.CHAT_HISTORY_ITEM_AUDIO,
             MSG_CONTENT   = "",
             THREAD_ID     = ViewModel.CurrentlyOpenDTO.EntryID
         };
         var bArray       = File.ReadAllBytes(filePath);
         var fileName     = Path.GetFileName(filePath);
         var requestModel = new AddPrivateVoiceMessageItemRequest()
         {
             FilebArray  = bArray,
             FileName    = fileName,
             ItemRequest = ItemModel
         };
         ViewModel.SendVoiceMessageCommand.Execute(requestModel);
     }
     else
     {
         DialogUtils.ShowOKDialog(this, @"Warning", @"No Internet Connection");
     }
 }