AcManager.Controls.CustomShowroom.LiteShowroomWrapperWithTools.GoToNormalMode C# (CSharp) Method

GoToNormalMode() protected final method

protected final GoToNormalMode ( ) : void
return void
        protected sealed override void GoToNormalMode() {
            _switchingInProgress = true;

            try {
                var area = Screen.PrimaryScreen.WorkingArea;
                var size = ValuesStorage.GetPoint(KeyNormalSize, new Point(1600, 900));
                var pos = ValuesStorage.GetPoint(KeyNormalPos, new Point((area.Width - size.X) / 2, (area.Height - size.Y) / 2));

                Form.Width = MathF.Clamp((int)size.X, 320, area.Width);
                Form.Height = MathF.Clamp((int)size.Y, 200, area.Height);
                Form.Top = MathF.Clamp((int)pos.Y, 0, area.Height - Form.Height);
                Form.Left = MathF.Clamp((int)pos.X, 0, area.Width - Form.Width);

                Form.WindowState = ValuesStorage.GetBool(KeyNormalMaximized) ? FormWindowState.Maximized : FormWindowState.Normal;
                Form.FormBorderStyle = FormBorderStyle.Sizable;
                Form.TopMost = false;
                FullscreenEnabled = ValuesStorage.GetBool(KeyNormalFullscreen);

                Renderer.Width = Form.ClientSize.Width;
                Renderer.Height = Form.ClientSize.Height;

                if (_lastVisibleTools.HasValue) {
                    _helper.Visible = _lastVisibleTools.Value;
                }
            } finally {
                _switchingInProgress = false;
            }
        }