Esempio n. 1
0
        public void saveNewSettings(string filename)
        {
            stringOfRSFileNames = StringCollectionConverter.convert(defaultRSFileNames);
            try
            {
                ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap();
                fileMap.ExeConfigFilename = filename;  // relative path names possible

                // Open another config file
                Configuration config =
                    ConfigurationManager.OpenMappedExeConfiguration(fileMap,
                                                                    ConfigurationUserLevel.None);


                // You need to remove the old settings object before you can replace it
                config.Sections.Remove("GraphSynthSettings");
                // with an updated one
                config.Sections.Add("GraphSynthSettings", this);
                // Write the new configuration data to the XML file
                config.Save();
            }
            catch (Exception e)
            {
                MessageBox.Show("The configuration file did not save becuase of error: " + e.ToString(),
                                "Error Saving config file.", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 public override object ConvertFrom(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
 {
     if (value.GetType() == typeof(string))
     {
         return(StringCollectionConverter.convert((string)value));
     }
     else
     {
         return(null);
     }
 }
Esempio n. 3
0
 /// <summary>
 ///   For subsequent instances of GraphSynth, simply get to the original and pass it
 ///   the files that are to be opened - these are passed as the arguments.
 /// </summary>
 /// <param name = "e"><see cref = "T:Microsoft.VisualBasic.ApplicationServices.StartupNextInstanceEventArgs" />. Contains the command-line arguments of the subsequent application instance and indicates whether the first application instance should be brought to the foreground upon exiting the exception handler.</param>
 protected override void OnStartupNextInstance(StartupNextInstanceEventArgs e)
 {
     base.OnStartupNextInstance(e);
     GSApp.InputArgs = new List <string>(e.CommandLine);
     SearchIO.output(StringCollectionConverter.Convert(GSApp.InputArgs));
     GSApp.ParseArguments();
     if (GSApp.ArgAltConfig)
     {
         GSApp.settings =
             GlobalSettings.readInSettings(GSApp.AlternateConfig);
     }
     GSApp.OpenFiles();
     GSApp.main.setUpGraphElementAddButtons();
     GSApp.main.setUpGraphLayoutMenu();
     GSApp.main.setUpSearchProcessMenu();
     GSApp.main.Activate();
 }
Esempio n. 4
0
 private void setUpRuleSetList(string names)
 {
     defaultRSFileNames = StringCollectionConverter.convert(names);
     for (int i = defaultRSFileNames.Count; i != 0; i--)
     {
         if (defaultRSFileNames[i - 1].Equals("xml"))
         {
             defaultRSFileNames.RemoveAt(i - 1);
         }
         else if (!defaultRSFileNames[i - 1].EndsWith(".xml"))
         {
             defaultRSFileNames[i - 1] += ".xml";
         }
     }
     if (defaultRSFileNames.Count == 0)
     {
         defaultRSFileNames.Add("");
     }
 }