hMailServer.Administrator.formMain.LoadWindowSettings C# (CSharp) Method

LoadWindowSettings() private method

private LoadWindowSettings ( ) : void
return void
        private void LoadWindowSettings()
        {
            RegistryKey currentUserKey = Registry.CurrentUser;
            RegistryKey administratorKey = currentUserKey.CreateSubKey("Software\\hMailServer\\Administrator");

            object value = administratorKey.GetValue("WindowWidth", "800");
            if (value != null)
                this.Width = Convert.ToInt32(value);

            value = administratorKey.GetValue("WindowHeight", "600");
            if (value != null)
                this.Height = Convert.ToInt32(value);

            value = administratorKey.GetValue("SplitterDistance", "250");
            if (value != null)
                this.splitContainer.SplitterDistance = Convert.ToInt32(value);

            value = administratorKey.GetValue("WindowLeft", "0");
            if (value != null && Convert.ToInt32(value) > 0)
                this.Left = Convert.ToInt32(value);

            value = administratorKey.GetValue("WindowTop", "0");
            if (value != null && Convert.ToInt32(value) > 0)
                this.Top = Convert.ToInt32(value);

            value = administratorKey.GetValue("WindowState", "0");
            if (value != null)
            {
                string val = (string)value;
                switch (val)
                {
                    case "Maximized":
                        this.WindowState = FormWindowState.Maximized;
                        break;
                    case "Minimized":
                        this.WindowState = FormWindowState.Minimized;
                        break;
                    case "Normal":
                        this.WindowState = FormWindowState.Normal;
                        break;
                }
            }

            value = administratorKey.GetValue("Language", "English");
            if (value != null)
                _language = Convert.ToString(value);
        }