private async void refreshTimer_Tick(object sender, EventArgs e) { if (!isConnected) { return; } if (!canCommunicate) { return; } canCommunicate = false; var pendingMessagesRequest = new Messenger.PendingMessagesRequest { TimeStamp = lastTimeStamp }; var result = await client.RequestPendingMessagesAsync(pendingMessagesRequest); if (result.Result.Result == Messenger.ResultReply.Types.Result.Failed) { return; } foreach (var message in result.TextMessages) { textMessages.AppendText(message); } textMessages.ScrollToEnd(); canCommunicate = true; lastTimeStamp = GetServerTimeStamp(); }