GitUI.GitExtensionsForm.SavePosition C# (CSharp) Метод

SavePosition() защищенный Метод

Save the position of a form to the user settings. Hides the window as a side-effect.
protected SavePosition ( String name ) : void
name String The name to use when writing the position to the /// settings
Результат void
        protected void SavePosition(String name)
        {
            try
            {
                var rectangle =
                    WindowState == FormWindowState.Normal
                        ? DesktopBounds
                        : RestoreBounds;

                var formWindowState =
                    WindowState == FormWindowState.Maximized
                        ? FormWindowState.Maximized
                        : FormWindowState.Normal;

                var position = new WindowPosition(rectangle, formWindowState);

                // Write to the user settings:
                if (Properties.Settings.Default.WindowPositions == null)
                    Properties.Settings.Default.WindowPositions = new WindowPositionList();
                Properties.Settings.Default.WindowPositions[name] = position;
                Properties.Settings.Default.Save();
            }
            catch (ConfigurationException)
            {
                //TODO: howto restore a corrupted config? Properties.Settings.Default.Reset() doesn't work.
            }
        }