private void AddToExecutionQueue(string runProfileName) { Task.Run(() => { try { ConfigClient c = App.GetDefaultConfigClient(); c.AddToExecutionQueue(this.ManagementAgentID, runProfileName); } catch (EndpointNotFoundException ex) { Trace.WriteLine(ex.ToString()); MessageBox.Show($"Could not contact the AutoSync service", "AutoSync service unavailable", MessageBoxButton.OK, MessageBoxImage.Error); } catch (Exception ex) { MessageBox.Show($"Could not add the run profile to the execution queue\r\n\r\n{ex.Message}", "Error", MessageBoxButton.OK, MessageBoxImage.Error); Trace.WriteLine("Could not add the run profile to the execution queue"); Trace.WriteLine(ex.ToString()); } }); }