/// <summary> /// Try to load information about all available framework reflection data sets /// </summary> /// <param name="currentProject">The current Sandcastle project</param> public void LoadReflectionDataSetInfo(SandcastleProject currentProject) { if (reflectionDataSets != null && currentProject != null && currentProject.Filename != lastProjectName) { return; } lastProjectName = currentProject?.Filename; try { Mouse.OverrideCursor = Cursors.Wait; if (currentProject != null) { reflectionDataSets = new ReflectionDataSetDictionary(currentProject.ComponentSearchPaths); } else { reflectionDataSets = new ReflectionDataSetDictionary(null); } } catch (Exception ex) { Debug.WriteLine(ex.ToString()); MessageBox.Show("Unexpected error loading reflection data set info: " + ex.Message, Constants.AppName, MessageBoxButton.OK, MessageBoxImage.Error); } finally { Mouse.OverrideCursor = null; } cboFrameworkVersion.Items.Clear(); if (reflectionDataSets.Keys.Count == 0) { imgFrameworkWarning.Visibility = Visibility.Visible; MessageBox.Show("No valid reflection data sets found", Constants.AppName, MessageBoxButton.OK, MessageBoxImage.Information); reflectionDataSets.Add(ReflectionDataSetDictionary.DefaultFrameworkTitle, new ReflectionDataSet { Title = ReflectionDataSetDictionary.DefaultFrameworkTitle }); } else { imgFrameworkWarning.Visibility = Visibility.Hidden; foreach (string dataSetName in reflectionDataSets.Keys.OrderBy(k => k)) { cboFrameworkVersion.Items.Add(dataSetName); } cboFrameworkVersion.SelectedItem = ReflectionDataSetDictionary.DefaultFrameworkTitle; } }
//===================================================================== /// <summary> /// Try to load information about all available framework reflection data sets /// </summary> /// <param name="currentProject">The current Sandcastle project</param> private void LoadReflectionDataSetInfo(SandcastleProject currentProject) { try { Cursor.Current = Cursors.WaitCursor; lastProjectName = currentProject == null ? null : currentProject.Filename; if (currentProject != null) { reflectionDataSets = new ReflectionDataSetDictionary(new[] { currentProject.ComponentPath, Path.GetDirectoryName(currentProject.Filename) }); } else { reflectionDataSets = new ReflectionDataSetDictionary(null); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); MessageBox.Show("Unexpected error loading plug-ins: " + ex.Message, messageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { Cursor.Current = Cursors.Default; } if (reflectionDataSets.Keys.Count == 0) { epWarning.SetError(cboFrameworkVersion, "No valid reflection data sets found. Do you need " + "to install the NuGet packages for them?"); MessageBox.Show("No valid reflection data sets found", messageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Information); reflectionDataSets.Add(ReflectionDataSetDictionary.DefaultFrameworkTitle, new ReflectionDataSet { Title = ReflectionDataSetDictionary.DefaultFrameworkTitle }); } else { epWarning.SetError(cboFrameworkVersion, String.Empty); } }