private void OnAssemblySelected(AssemblyNode assemblyNode, Action completeAction = null) { if (assemblyNode.Children.Count == 0) { Task loadingTask = assemblyNode.LoadItemsAsync(() => assemblyNode.IsExpanded = false); loadingTask.ContinueWith(t => { if (!t.IsCanceled && !t.IsFaulted) { if (completeAction != null) { completeAction(); } } else if (t.Exception.InnerExceptions.Count > 0) { // already shown an error window. //this.ShowExceptionMessage(t.Exception.InnerExceptions); } }, TaskScheduler.FromCurrentSynchronizationContext()); } else { if (completeAction != null) { completeAction(); } } }