private async void sentMessage_Click(object sender, RoutedEventArgs e) { tbMessage.IsEnabled = false; bool checkDone = false; await Task.Delay(TimeSpan.FromSeconds(0.3)); threadController.PostComment(tbMessage.Text, idThread, ref checkDone); if (checkDone) { Loader(); tbMessage.Text = string.Empty; tbMessage.IsEnabled = true; myPopupPostMessage.IsOpen = false; } }