private void ask_Click(object sender, RoutedEventArgs e) { UiDispatcher disp = new UiDispatcher(this, true, request.Text); // Check state with SignalR hub if (_Connected && !_Waiting) { // If text if (!string.IsNullOrEmpty(request.Text)) { // Add the text disp.AddConversationText(); // Invoke the request _Hub.Invoke("sendRequest", new object[] { _Connection.ConnectionId, request.Text }); // Clear the text request.Text = string.Empty; } } }