Exemple #1
0
        private void SwitchSettings(NSView newSettings)
        {
            UnfocusElement(); // update bindings

            bool firstTime = __CurrentSettingsView == null;

            if (__CurrentSettingsView != null)
            {
                __CurrentSettingsView.RemoveFromSuperview();
            }

            CGRect newFrame = new CGRect(
                newSettings.Frame.X,
                SettingsView.Frame.Height - newSettings.Frame.Height,
                newSettings.Frame.Width,
                newSettings.Frame.Height);

            newSettings.Frame = newFrame;

            SettingsView.AddSubview(newSettings);

            __CurrentSettingsView = newSettings;

            // Set new window height
            var newHeight = newSettings.Frame.Height + (Window.Frame.Height - SettingsView.Frame.Bottom);

            CGRect newRect = UIUtils.UpdateHeight(Window.Frame, (float)newHeight);

            Window.SetFrame(newRect, true, !firstTime);
        }
Exemple #2
0
        public void UpdateWindowSize()
        {
            if (!NSThread.IsMain)
            {
                InvokeOnMainThread(() => UpdateWindowSize());
                return;
            }

            MainWindowController mainWndController = AppDelegate.GetMainWindowController();

            if (mainWndController == null)
            {
                return;
            }

            // Not permitted to do any action during view-change animation in progress
            if (mainWndController.IsAnimationInProgress)
            {
                // Trying to update window size later
                System.Threading.Tasks.Task.Run(() =>
                {
                    System.Threading.Thread.Sleep(10);
                    UpdateWindowSize();
                });
                return;
            }

            nfloat height = GuiButtonsPanel.Frame.Height
                            + __ConnectButtonViewController.View.Frame.Height
                            + __ServerSelectionController.Height
                            + 32;

            if (__Window.Frame.Height == height)
            {
                return;
            }

            __Window.SetFrame(
                UIUtils.UpdateHeight(
                    __Window.Frame,
                    height
                    ),
                true, true);
        }