Exemplo n.º 1
0
        public void changeCurrentContent(IContentPage content, bool recordOnHistory = true)
        {
            IContentPage lastContent = currentContent as IContentPage;

            if (lastContent != null)
            {
                lastContent.finalizePage();
            }

            if (lastContent is MyUserControl)
            {
                if (recordOnHistory)
                {
                    history.Push(lastContent as MyUserControl);
                }
            }

            if (content is MyUserControl)
            {
                currentContent = content as MyUserControl;
                currentContent.appear(DockStyle.Fill, mainPanel);

                ContentArgs e = new ContentArgs(content);
                OnContentChange(e);
            }
            content.initializePage();
        }
Exemplo n.º 2
0
        public void returnToPreviousPage()
        {
            if (history.Count == 0)
            {
                return;
            }

            MyUserControl previousPage = history.Pop();

            if (previousPage is IContentPage)
            {
                changeCurrentContent(previousPage as IContentPage, false);
            }
        }
Exemplo n.º 3
0
        public void changeCurrentContent(IContentPage content)
        {
            IContentPage lastContent = currentContent as IContentPage;

            if (lastContent != null)
            {
                lastContent.finalizePage();
            }

            if (content is MyUserControl)
            {
                currentContent = content as MyUserControl;
                currentContent.appear(DockStyle.Fill, mainPanel);

                ContentArgs e = new ContentArgs(content);
                OnContentChange(e);
            }
            content.initializePage();
        }
Exemplo n.º 4
0
        public void appear(DockStyle dockStyle)
        {
            if (dockStyle == DockStyle.Fill)
            {
                foreach (Control control in container.Controls)
                {
                    MyUserControl myUserControl = control as MyUserControl;
                    if (myUserControl != null)
                    {
                        myUserControl.disappear();
                    }
                }

                container.Controls.Clear();
            }

            this.container.SuspendLayout();
            this.Dock     = dockStyle;
            this.Location = new Point(0, 0);
            this.container.Controls.Add(this);
            this.container.ResumeLayout(true);
        }