예제 #1
0
        /// <summary>
        /// Sets a new side panel and refreshes the window. The panel is
        /// managed by the SidePanelContainer from now on.
        /// </summary>
        /// <param name="panel">SidePanel to embed and to manage.</param>
        public void SetSidePanel(SidePanel panel)
        {
            panel.OnFirstShown(_parent);

            this.SuspendLayout();

            //Title
            this.Text = panel.Title;

            //Set panel
            CurrentSidePanel = panel;
            panel.RequestClosing += RequestClosingHandler;
            this.Controls.Add(panel);

            var minSize = panel.MinimumSize.Expand(this.Padding);
            this.ClientSize = minSize;
            this.EnsureMinimumClientSize(minSize);

            //Enable glass if needed
            var margins = panel.GlassMargins;
            if (margins.HasValue) {
                this.GlassMargins = margins.Value;
                this.GlassEnabled = true;
            }
            else
                this.GlassEnabled = false;

            this.ResumeLayout();
        }
        /// <summary>
        /// Sets a new side panel and refreshes the window. The panel is
        /// managed by the SidePanelContainer from now on.
        /// </summary>
        /// <param name="panel">SidePanel to embed and to manage.</param>
        public void SetSidePanel(SidePanel panel)
        {
            panel.OnFirstShown(_parent);

            this.SuspendLayout();

            //Title
            this.Text = panel.Title;

            //Set panel
            CurrentSidePanel      = panel;
            panel.RequestClosing += RequestClosingHandler;
            this.Controls.Add(panel);

            var minSize = panel.MinimumSize.Expand(this.Padding);

            this.ClientSize = minSize;
            this.EnsureMinimumClientSize(minSize);

            //Enable glass if needed
            var margins = panel.GlassMargins;

            if (margins.HasValue)
            {
                this.GlassMargins = margins.Value;
                this.GlassEnabled = true;
            }
            else
            {
                this.GlassEnabled = false;
            }

            this.ResumeLayout();
        }
예제 #3
0
        /// <summary>
        /// Opens a new side panel.
        /// </summary>
        /// <param name="panel">The side panel to embed.</param>
        public void SetSidePanel(SidePanel panel)
        {
            if (IsSidePanelOpen) {
                CloseSidePanel();
            }

            _sidePanelContainer = new SidePanelContainer(this);
            _sidePanelContainer.SetSidePanel(panel);
            _sidePanelContainer.Location = ComputeSidePanelLocation(_sidePanelContainer);
            _sidePanelContainer.Show(this);
        }
예제 #4
0
        /// <summary>
        /// Opens a new side panel.
        /// </summary>
        /// <param name="panel">The side panel to embed.</param>
        public void SetSidePanel(SidePanel panel)
        {
            if (IsSidePanelOpen)
            {
                CloseSidePanel();
            }

            _sidePanelContainer = new SidePanelContainer(this);
            _sidePanelContainer.SetSidePanel(panel);
            _sidePanelContainer.Location = ComputeSidePanelLocation(_sidePanelContainer);
            _sidePanelContainer.Show(this);
        }
예제 #5
0
        /// <summary>
        /// Sets a new side panel and refreshes the window. The panel is
        /// managed by the SidePanelContainer from now on.
        /// </summary>
        /// <param name="panel">SidePanel to embed and to manage.</param>
        public void SetSidePanel(SidePanel panel)
        {
            panel.OnFirstShown(_parent);

            this.SuspendLayout();

            //Title
            this.Text = panel.Title;

            //Set panel
            CurrentSidePanel      = panel;
            panel.RequestClosing += RequestClosingHandler;
            this.Controls.Add(panel);

            var minSize = panel.MinimumSize.Expand(this.Padding);

            this.ClientSize = minSize;
            this.EnsureMinimumClientSize(minSize);
            this.GlassMargins = panel.GlassMargins;

            this.ResumeLayout();
        }
예제 #6
0
        /// <summary>
        /// Removes the current side panel and disposes it (doesn't suspend layout).
        /// </summary>
        private void FreeSidePanelCore()
        {
            CurrentSidePanel.OnClosing(_parent);

            //Free hook
            CurrentSidePanel.RequestClosing -= RequestClosingHandler;

            //Remove
            this.Controls.Remove(CurrentSidePanel);

            //Free
            CurrentSidePanel.Dispose();
            CurrentSidePanel = null;
        }