private void requestSuggestion(bool auto)
{
try
{
// Send network request to Java ACP to request for suggestions
List<Suggestion> suggestions = null;
String wordsToSend = getWordsBeforeLastSentence();
wordsToSend = wordsToSend.TrimStart();
if (!wordsToSend.Trim().Equals(""))
{
suggestions = logic.requestSuggestion(wordsToSend, auto);
}
// Inform UI Thread to display suggestions
Globals.ThisAddIn.Dispatcher.Invoke(new callMainThreadDisplaySuggestionDelegate(callMainThreadDisplaySuggestion), new Object[] { suggestions, auto });
}
catch (System.Net.Sockets.SocketException e)
{
// Inform UI Thread to display error message
if (isEnabled)
{
markServerDown();
Globals.ThisAddIn.Dispatcher.Invoke(new displayMessageDelegate(displayMessage), new Object[] { ERROR_CONNECTION });
}
}
}