private async void RunButton_Click(object sender, RoutedEventArgs e) { _cmdSem.Wait(); try { if (RunButtonIcon.Symbol == Symbol.Stop) { _taskRunPoller.StopPolling(); _taskRunPoller = null; await Client.AbortTaskRun(_activeCmdTaskRun.Guid); CommandComplete(); } else { if (!String.IsNullOrWhiteSpace(CommandBox.Text)) { // Asynchronously run the command await ExecuteCommand(CommandBox.Text); } } } finally { _cmdSem.Release(); } }