Esempio n. 1
0
        /// <summary>
        /// Load the framework settings
        /// </summary>
        private void SaveFrameworkSettings()
        {
            RegistryKey regKey = Registry.CurrentUser.OpenSubKey(ApplicationRegistryKeyName, true);

            try
            {
                if (regKey == null)
                {
                    regKey = Registry.CurrentUser.CreateSubKey(ApplicationRegistryKeyName);
                }

                if (regKey != null && _mainDialog != null)
                {
                    regKey.SetValue("WasMaxed", _mainDialog.WindowState == FormWindowState.Maximized);
                    regKey.SetValue("Width", _mainDialog.Width);
                    regKey.SetValue("Height", _mainDialog.Height);
                    regKey.Flush();
                }
            }
            catch (Exception e)
            {
                string msg = string.Format("An error occured while saving framework settings: {0}\n\n{1}", e.Message, e.StackTrace);
                FrameworkManager.ShowMessageBox(msg, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                if (regKey != null)
                {
                    regKey.Close();
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Load the framework settings
        /// </summary>
        private void LoadFrameworkSettings()
        {
            RegistryKey regKey = Registry.CurrentUser.OpenSubKey(ApplicationRegistryKeyName);

            try
            {
                if (regKey != null && regKey.ValueCount > 0)
                {
                    _mainDialogWasMaxed = Convert.ToBoolean(regKey.GetValue("WasMaxed", false));
                    _mainDialogWidth    = Convert.ToInt32(regKey.GetValue("Width", 800));
                    _mainDialogHeight   = Convert.ToInt32(regKey.GetValue("Height", 600));
                }
                else
                {
                    _mainDialogWasMaxed = false;
                    _mainDialogWidth    = 800;
                    _mainDialogHeight   = 600;
                }
            }
            catch (Exception e)
            {
                string msg = string.Format("An error occured while loading framework settings: {0}\n\n{1}", e.Message, e.StackTrace);
                FrameworkManager.ShowMessageBox(msg, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                if (regKey != null)
                {
                    regKey.Close();
                }
            }
        }
Esempio n. 3
0
 static FrameworkManager()
 {
     _frameworkManager = new FrameworkManager();
 }