//===================================================================== /// <summary> /// Constructor /// </summary> /// <param name="project">The current project</param> /// <param name="configuration">The current configuration element</param> public AdditionalReferenceLinksConfigDlg(SandcastleProject project, XElement configuration) { InitializeComponent(); cboHtmlSdkLinkType.ItemsSource = cboWebsiteSdkLinkType.ItemsSource = (new Dictionary <string, string> { { HtmlSdkLinkType.Msdn.ToString(), "Links to online help topics" }, { HtmlSdkLinkType.None.ToString(), "No SDK links" } }).ToList(); cboMSHelpViewerSdkLinkType.ItemsSource = (new Dictionary <string, string> { { MSHelpViewerSdkLinkType.Msdn.ToString(), "Links to online help topics" }, { MSHelpViewerSdkLinkType.Id.ToString(), "ID links within the collection" }, { MSHelpViewerSdkLinkType.None.ToString(), "No SDK links" } }).ToList(); this.project = project ?? throw new ArgumentNullException(nameof(project)); this.configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); if (!configuration.IsEmpty) { // Load the current settings foreach (var reference in configuration.Descendants("target")) { lbReferences.Items.Add(ReferenceLinkSettings.FromXml(project, reference)); } } btnDeleteReferenceProject.IsEnabled = grpReferenceProps.IsEnabled = lbReferences.Items.Count != 0; if (lbReferences.Items.Count != 0) { lbReferences.SelectedIndex = 0; } }
/// <summary> /// Add a new reference links project /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event arguments</param> private void btnAddReferenceProject_Click(object sender, RoutedEventArgs e) { using (var dlg = new System.Windows.Forms.OpenFileDialog()) { dlg.Title = "Select the help file builder project(s)"; dlg.Filter = "Sandcastle Help File Builder Project Files " + "(*.shfbproj)|*.shfbproj|All Files (*.*)|*.*"; dlg.InitialDirectory = Directory.GetCurrentDirectory(); dlg.DefaultExt = "shfbproj"; dlg.Multiselect = true; // If selected, add the file(s) if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { foreach (string file in dlg.FileNames) { var newItem = new ReferenceLinkSettings(project) { HelpFileProject = new FilePath(file, project) }; // It will end up on the last one added lbReferences.SelectedIndex = lbReferences.Items.Add(newItem); } btnDeleteReferenceProject.IsEnabled = grpReferenceProps.IsEnabled = true; } } }