Пример #1
0
        /// <summary>
        /// Gets the current applications &lt;PlaneDisaster&gt; section.
        /// </summary>
        /// <param name="ConfigLevel">
        /// The &lt;ConfigurationUserLevel&gt; that the config file
        /// is retrieved from.
        /// </param>
        /// <returns>
        /// The configuration file's &lt;PlaneDisaster&gt; section.
        /// </returns>
        public static PlaneDisasterSettings GetSection(ConfigurationUserLevel ConfigLevel)
        {
            /*
             * This class is setup using a factory pattern that forces you to
             * name the section &lt;PlaneDisaster&gt; in the config file.
             * If you would prefer to be able to specify the name of the section,
             * then remove this method and mark the constructor public.
             */
            System.Configuration.Configuration Config = ConfigurationManager.OpenExeConfiguration
                                                            (ConfigLevel);
            PlaneDisasterSettings oPlaneDisasterSettings;

            oPlaneDisasterSettings =
                (PlaneDisasterSettings)Config.GetSection("PlaneDisasterSettings");
            if (oPlaneDisasterSettings == null)
            {
                oPlaneDisasterSettings = new PlaneDisasterSettings();
                Config.Sections.Add("PlaneDisasterSettings", oPlaneDisasterSettings);
            }
            oPlaneDisasterSettings._Config = Config;

            return(oPlaneDisasterSettings);
        }
        /// <summary>
        /// Gets the current applications &lt;PlaneDisaster&gt; section.
        /// </summary>
        /// <param name="ConfigLevel">
        /// The &lt;ConfigurationUserLevel&gt; that the config file
        /// is retrieved from.
        /// </param>
        /// <returns>
        /// The configuration file's &lt;PlaneDisaster&gt; section.
        /// </returns>
        public static PlaneDisasterSettings GetSection(ConfigurationUserLevel ConfigLevel)
        {
            /*
             * This class is setup using a factory pattern that forces you to
             * name the section &lt;PlaneDisaster&gt; in the config file.
             * If you would prefer to be able to specify the name of the section,
             * then remove this method and mark the constructor public.
             */
            System.Configuration.Configuration Config = ConfigurationManager.OpenExeConfiguration
                (ConfigLevel);
            PlaneDisasterSettings oPlaneDisasterSettings;

            oPlaneDisasterSettings =
                (PlaneDisasterSettings)Config.GetSection("PlaneDisasterSettings");
            if (oPlaneDisasterSettings == null) {
                oPlaneDisasterSettings = new PlaneDisasterSettings();
                Config.Sections.Add("PlaneDisasterSettings", oPlaneDisasterSettings);
            }
            oPlaneDisasterSettings._Config = Config;

            return oPlaneDisasterSettings;
        }
Пример #3
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        internal MainForm()
        {
            InitializeComponent();

            /* ListBox Right Click event handlers */
            lstProcedures.MouseDown += new MouseEventHandler(this.Lst_RightClickSelect);
            lstTables.MouseDown += new MouseEventHandler(this.Lst_RightClickSelect);
            lstViews.MouseDown += new MouseEventHandler(this.Lst_RightClickSelect);

            gridResults.DataError += new DataGridViewDataErrorEventHandler(this.EvtDataGridError);

            _oPlaneDisasterSettings = PlaneDisasterSettings.GetSection(ConfigurationUserLevel.PerUserRoamingAndLocal);
            _oPlaneDisasterSettings.RecentFiles.GenerateOpenRecentMenu
                (openRecentToolStripMenuItem,
                 menuOpenRecent_Click);
        }