public NugetPackageBrowserDialog(LoadedNugetPackage package) { InitializeComponent(); #if DEBUG this.AttachDevTools(); #endif this.Package = package; this.Package.PropertyChanged += Package_PropertyChanged; DataContext = this; }
async void LoadAssemblies(IEnumerable <string> fileNames, List <LoadedAssembly> loadedAssemblies = null, bool focusNode = true) { SharpTreeNode lastNode = null; foreach (string file in fileNames) { switch (Path.GetExtension(file)) { case ".nupkg": LoadedNugetPackage package = new LoadedNugetPackage(file); var selectionDialog = new NugetPackageBrowserDialog(package); selectionDialog.Owner = this; if (await selectionDialog.ShowDialog <bool>() != true) { break; } foreach (var entry in selectionDialog.SelectedItems) { var nugetAsm = assemblyList.OpenAssembly("nupkg://" + file + ";" + entry.Name, entry.Stream, true); if (nugetAsm != null) { if (loadedAssemblies != null) { loadedAssemblies.Add(nugetAsm); } else { var node = assemblyListTreeNode.FindAssemblyNode(nugetAsm); if (node != null && focusNode) { treeView.SelectedItems.Add(node); lastNode = node; } } } } break; default: var asm = assemblyList.OpenAssembly(file); if (asm != null) { if (loadedAssemblies != null) { loadedAssemblies.Add(asm); } else { var node = assemblyListTreeNode.FindAssemblyNode(asm); if (node != null && focusNode) { treeView.SelectedItems.Add(node); lastNode = node; } } } break; } if (lastNode != null && focusNode) { treeView.FocusNode(lastNode); } } }