/// <summary> /// Add a new wildcard reference path /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event arguments</param> private void btnAddReferencePath_Click(object sender, RoutedEventArgs e) { WildcardReferenceSettings newItem; using (var dlg = new System.Windows.Forms.FolderBrowserDialog()) { dlg.Description = "Select the folder for the new project"; dlg.SelectedPath = Directory.GetCurrentDirectory(); // If selected, add the file(s) if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { newItem = new WildcardReferenceSettings { ReferencePath = new FolderPath(dlg.SelectedPath, project) }; lbReferences.SelectedIndex = lbReferences.Items.Add(newItem); btnDeleteReferencePath.IsEnabled = grpReferenceProps.IsEnabled = true; } } }
//===================================================================== /// <summary> /// Constructor /// </summary> /// <param name="project">The current project</param> /// <param name="configuration">The current configuration element</param> public WildcardReferencesConfigDlg(SandcastleProject project, XElement configuration) { InitializeComponent(); 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("reference")) { lbReferences.Items.Add(WildcardReferenceSettings.FromXml(project, reference)); } } btnDeleteReferencePath.IsEnabled = grpReferenceProps.IsEnabled = lbReferences.Items.Count != 0; if (lbReferences.Items.Count != 0) { lbReferences.SelectedIndex = 0; } }