public async Task SendMessageToUser(string message) { sender.BeginSetComposing(true, null, null); await Task.Delay(3000); sender.BeginSendMessage(message, AfterMessageSent, null); }
/// <summary> /// Sends a notification about the composing state. /// </summary> public void SendComposingNotification(bool isComposing) { //send the event 'as-is' without checking the success try { myImModality.BeginSetComposing(isComposing, null, null); } catch (LyncClientException e) { var eventHandler = MessageError; if (eventHandler != null) { eventHandler(e); } } catch (SystemException e) { if (LyncModelExceptionHelper.IsLyncException(e)) { // Handle the exception thrown by the Lync Model API. var eventHandler = MessageError; if (eventHandler != null) { eventHandler(e); } } else { // Rethrow the SystemException which did not come from the Lync Model API. throw; } } }