/// <summary> /// Creates a new user control for the job and adds it to the stackpanel /// </summary> private void RegisterNewJob(CacheJob sender, EventArgs args) { if (!Dispatcher.CheckAccess()) { Dispatcher.Invoke(() => RegisterNewJob(sender, args)); return; } var userControl = new CacheJobUserControl(sender); jobsStackPanel.Children.Add(userControl); }