예제 #1
0
 /// <summary>
 /// This method will retrieve the configuration settings.
 /// </summary>
 private void GetConfiguration()
 {
     try
     {
         m_config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal);
         if (m_config.Sections["TracePreferences"] == null)
         {
             m_settings = new TracePreferences();
             m_config.Sections.Add("TracePreferences", m_settings);
             m_config.Save(ConfigurationSaveMode.Full);
         }
         else
             m_settings = (TracePreferences)m_config.GetSection("TracePreferences");
     }
     catch (InvalidCastException e)
     {
         System.Diagnostics.Trace.WriteLine("Preference Error - " + e.Message, "MainForm.GetConfiguration");
         MessageBoxOptions options = 0;
         MessageBox.Show(Properties.Resources.PREF_NOTLOADED, Properties.Resources.PREF_CAPTION,
                     MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, options);
         m_settings = new TracePreferences();
     }
     catch (ArgumentException e)
     {
         System.Diagnostics.Trace.WriteLine("Argument Error - " + e.Message, "MainForm.GetConfiguration");
         throw;
     }
     catch (ConfigurationErrorsException e)
     {
         System.Diagnostics.Trace.WriteLine("Configuration Error - " + e.Message, "MainForm.GetConfiguration");
         throw;
     }
 }
예제 #2
0
 /// <summary>
 /// This constructor will initialise the internal members
 /// </summary>
 /// <param name="settings">The settings handle</param>
 public ScanningSettings(TracePreferences settings)
 {
     InitializeComponent();
     if (settings != null)
         m_settings = settings;
     m_name = "SCANSETTING";
     m_desc = ResourceManager.GetString("SCANSETTING_DESC",
         "Workshare.Trace.UI.Properties.Resources",
         typeof(ScanningSettings).Assembly);
     m_parent = "ENVIRO";
     this.TopLevel = false;
 }