public First_Launch_Form4() { InitializeComponent(); // Get the list of enabled addons enabled = MetaTemplate_UserSettings.AddOns_Enabled; // Configure the list to hold add ons and radio buttons addOns = new List <AddOn_Info>(); checkBoxes = new List <CheckBox>(); // Start with a sorted list though SortedList <string, AddOn_Info> sorter = new SortedList <string, AddOn_Info>(); // Look for possible add on files string addOnsDirectory = Application.StartupPath + "\\AddOns"; string[] possible_add_ons = Directory.GetFiles(addOnsDirectory, "*.xml"); foreach (string possible_add_on in possible_add_ons) { try { // Read this template Template.Template thisTemplate = Template.Template.Read_XML_Template(possible_add_on); // Get the name of this add-on from the filename string filename = (new FileInfo(possible_add_on)).Name.Replace(".xml", ""); // Set the language thisTemplate.Set_Language(MetaTemplate_UserSettings.Last_Language); // Create this add on info object AddOn_Info newAddOn = new AddOn_Info(filename, thisTemplate.Title, thisTemplate.Notes); // Add this to the sorted list of add ons sorter.Add(filename.ToUpper(), newAddOn); } catch (Exception ee) { MessageBox.Show("ERROR READING " + possible_add_on + "\n\n" + ee.Message, "Error Reading File", MessageBoxButtons.OK, MessageBoxIcon.Error); } } // Now add them to the list, sorted foreach (string thisKey in sorter.Keys) { addOns.Add(sorter[thisKey]); } // Add data to the form for each add on int addOnCount = 0; int height = 15; foreach (AddOn_Info thisAddOn in addOns) { draw_this_add_on(addOnCount, height, thisAddOn); addOnCount++; height += 60; } }
public Metadata_Preferences(bool Editing_Item_Currently) { InitializeComponent(); editingItemCurrently = Editing_Item_Currently; Project_File_To_Edit = String.Empty; // Set the primary metadata scheme switch (MetaTemplate_UserSettings.Bibliographic_Metadata) { case Bibliographic_Metadata_Enum.DublinCore: dublinCoreRadioButton.Checked = true; break; case Bibliographic_Metadata_Enum.MarcXML: marcXmlRadioButton.Checked = true; break; case Bibliographic_Metadata_Enum.MODS: modsRadioButton.Checked = true; break; } // Populate all other templates string directory = Application.StartupPath + "\\Templates"; string[] templates = Directory.GetFiles(directory, "*.xml"); string text = String.Empty; foreach (string thisTemplate in templates) { FileInfo fileInfo = new FileInfo(thisTemplate); string filename = fileInfo.Name.Replace(fileInfo.Extension, ""); string filename_upper = filename.ToUpper(); if ((filename_upper != "DUBLINCORE") && (filename_upper != "STANDARD") && (filename_upper != "COMPLETE")) { otherComboBox.Items.Add(filename); if (filename_upper == MetaTemplate_UserSettings.Default_Template.ToUpper()) { text = filename; } } } if (text.Length > 0) { otherComboBox.Text = text; } else if (otherComboBox.Items.Count > 0) { otherComboBox.SelectedIndex = 0; } // If no others in the template directory, hide those options if (otherComboBox.Items.Count == 0) { otherComboBox.Hide(); otherRadioButton.Hide(); } switch (MetaTemplate_UserSettings.Default_Template.ToUpper()) { case "DUBLINCORE": dcTemplateRadioButton.Checked = true; break; case "STANDARD": standardRadioButton.Checked = true; break; case "COMPLETE": completeRadioButton.Checked = true; break; default: if (text.Length != 0) { otherRadioButton.Checked = true; otherComboBox.Enabled = true; } else { if (MetaTemplate_UserSettings.Bibliographic_Metadata == Bibliographic_Metadata_Enum.DublinCore) { dublinCoreRadioButton.Checked = true; } else { standardRadioButton.Checked = true; } } break; } // Get the list of PROJECTS string[] project_files = Directory.GetFiles(Application.StartupPath + "\\Projects\\", "*.pmets"); foreach (string thisFile in project_files) { FileInfo thisFileInfo = new FileInfo(thisFile); string name = thisFileInfo.Name.Replace(thisFileInfo.Extension, ""); projectComboBox.Items.Add(name); } if ((MetaTemplate_UserSettings.Current_Project.Length > 0) && (projectComboBox.Items.Contains(MetaTemplate_UserSettings.Current_Project))) { projectComboBox.Text = MetaTemplate_UserSettings.Current_Project; } else { projectComboBox.SelectedIndex = 0; } // Get the list of enabled addons enabled = MetaTemplate_UserSettings.AddOns_Enabled; // Configure the list to hold add ons and radio buttons addOns = new List <AddOn_Info>(); checkBoxes = new List <CheckBox>(); // Start with a sorted list though SortedList <string, AddOn_Info> sorter = new SortedList <string, AddOn_Info>(); // Look for possible add on files string addOnsDirectory = Application.StartupPath + "\\AddOns"; string[] possible_add_ons = Directory.GetFiles(addOnsDirectory, "*.xml"); foreach (string possible_add_on in possible_add_ons) { try { // Read this template Template.Template thisTemplate = Template.Template.Read_XML_Template(possible_add_on); // Get the name of this add-on from the filename string filename = (new FileInfo(possible_add_on)).Name.Replace(".xml", ""); // Set the language thisTemplate.Set_Language(MetaTemplate_UserSettings.Last_Language); // Create this add on info object AddOn_Info newAddOn = new AddOn_Info(filename, thisTemplate.Title, thisTemplate.Notes); // Add this to the sorted list of add ons sorter.Add(filename.ToUpper(), newAddOn); } catch (Exception ee) { MessageBox.Show("ERROR READING " + possible_add_on + "\n\n" + ee.Message, "Error Reading File", MessageBoxButtons.OK, MessageBoxIcon.Error); } } // Now add them to the list, sorted foreach (string thisKey in sorter.Keys) { addOns.Add(sorter[thisKey]); } // Add data to the form for each add on int addOnCount = 0; int height = 15; foreach (AddOn_Info thisAddOn in addOns) { draw_this_add_on(addOnCount, height, thisAddOn); addOnCount++; height += 60; } accountTextBox.Text = MetaTemplate_UserSettings.FDA_Account; subAccountTextBox.Text = MetaTemplate_UserSettings.FDA_SubAccount; projectTextBox.Text = MetaTemplate_UserSettings.FDA_Project; fdaCheckBox.Checked = MetaTemplate_UserSettings.FCLA_Flag_FDA; palmmCheckBox.Checked = MetaTemplate_UserSettings.FCLA_Flag_PALMM; palmmCodeTextBox.Text = MetaTemplate_UserSettings.PALMM_Code; sourceCodeTextBox.Text = MetaTemplate_UserSettings.Default_Source_Code; sourceStatementTextBox.Text = MetaTemplate_UserSettings.Default_Source_Statement; nameTextBox.Text = MetaTemplate_UserSettings.Individual_Creator; rightsTextBox.Text = MetaTemplate_UserSettings.Default_Rights_Statement; fundingTextBox.Text = MetaTemplate_UserSettings.Default_Funding_Note; checksumsCheckBox.Checked = MetaTemplate_UserSettings.Include_Checksums; showMetadataCheckBox.Checked = MetaTemplate_UserSettings.Show_Metadata_PostSave; alwaysAddPageImagesCheckBox.Checked = MetaTemplate_UserSettings.Always_Add_Page_Images; alwaysAddNonPageFilesCheckBox.Checked = MetaTemplate_UserSettings.Always_Add_NonPage_Files; alwaysRecurseWhenAddingFilesCheckBox.Checked = MetaTemplate_UserSettings.Always_Recurse_Through_Subfolders_On_New; subfoldersPageImagesSepFolderCheckBox.Checked = MetaTemplate_UserSettings.Page_Images_In_Seperate_Folders_Can_Be_Same_Page; if (MetaTemplate_UserSettings.METS_File_Extension == ".xml") { metsExtensionRadioButton.Checked = false; xmlExtensionRadioButton.Checked = true; } else { metsExtensionRadioButton.Checked = true; xmlExtensionRadioButton.Checked = false; } if (MetaTemplate_UserSettings.Perform_Version_Check_On_StartUp) { disableVersionCheckBox.Checked = false; } else { disableVersionCheckBox.Checked = true; } versionLabel.Text = "You are currently running version " + VersionConfigSettings.AppVersion + " of this application."; // Populate all the sobekcm default aggregations List <string> aggregations = MetaTemplate_UserSettings.SobekCM_Aggregations; if (aggregations != null) { if (aggregations.Count > 0) { aggregationTextBox1.Text = aggregations[0]; } if (aggregations.Count > 1) { aggregationTextBox2.Text = aggregations[1]; } if (aggregations.Count > 2) { aggregationTextBox3.Text = aggregations[2]; } if (aggregations.Count > 3) { aggregationTextBox4.Text = aggregations[3]; } if (aggregations.Count > 4) { aggregationTextBox5.Text = aggregations[4]; } } // Populate all the sobekcm default wordmarks List <string> wordmars = MetaTemplate_UserSettings.SobekCM_Wordmarks; if (wordmars != null) { if (wordmars.Count > 0) { wordmarksTextBox1.Text = wordmars[0]; } if (wordmars.Count > 1) { wordmarksTextBox2.Text = wordmars[1]; } if (wordmars.Count > 2) { wordmarksTextBox3.Text = wordmars[2]; } if (wordmars.Count > 3) { wordmarksTextBox4.Text = wordmars[3]; } if (wordmars.Count > 4) { wordmarksTextBox5.Text = wordmars[4]; } } // Populate all the sobekcm default web skins List <string> webskins = MetaTemplate_UserSettings.SobekCM_Web_Skins; if (webskins != null) { if (webskins.Count > 0) { webSkinTextBox1.Text = webskins[0]; } if (webskins.Count > 1) { webSkinTextBox2.Text = webskins[1]; } if (webskins.Count > 2) { webSkinTextBox3.Text = webskins[2]; } if (webskins.Count > 3) { webSkinTextBox4.Text = webskins[3]; } if (webskins.Count > 4) { webSkinTextBox5.Text = webskins[4]; } } // Populate all the sobekcm default viewers List <string> viewers = MetaTemplate_UserSettings.SobekCM_Viewers; if (viewers != null) { if (viewers.Count > 0) { viewersComboBox1.Text = viewers[0]; } if (viewers.Count > 1) { viewersComboBox2.Text = viewers[1]; } if (viewers.Count > 2) { viewersComboBox3.Text = viewers[2]; } if (viewers.Count > 3) { viewersComboBox4.Text = viewers[3]; } } // Hide the FCLA and SobekCM tabs to start with, if not selected as add-ons List <string> addons = MetaTemplate_UserSettings.AddOns_Enabled; int removed = 0; if (!addons.Contains("FCLA")) { tabControl1.TabPages.Remove(fclaTabPage); removed++; } if (!addons.Contains("SOBEKCM")) { tabControl1.TabPages.Remove(sobekcmTabPage); removed++; } if (removed >= 1) { generalOptionsTabPage.Text = "General Options"; } if (removed == 2) { schemeTabPage.Text = "Metadata Scheme"; } DialogResult = DialogResult.Cancel; }