Esempio n. 1
0
        private void navigationFrameMain_QueryControl(object sender, QueryControlEventArgs e)
        {
            if (sender is NavigationFrame)
            {
                NavigationFrame senderNavigationFrame = sender as NavigationFrame;

                if (senderNavigationFrame.Visible == false)
                {
                    throw new NotSupportedException();
                }

                NavigationPage activeNavigationPage = (NavigationPage)e.Page;
                int            controlsCount        = activeNavigationPage.Controls.Count;

                #region  Clear Form or Control
                if (false)
                {
                    foreach (var eachvar in navigationFrameMain.Controls)
                    {
                        if (eachvar is DevExpress.XtraBars.Navigation.NavigationPage)
                        {
                            DevExpress.XtraBars.Navigation.NavigationPage eachNavigationPage = eachvar as DevExpress.XtraBars.Navigation.NavigationPage;
                            if (eachNavigationPage == activeNavigationPage)
                            {
                                while (eachNavigationPage.Controls.Count > 0)
                                {
                                    var ctrl = eachNavigationPage.Controls[0];
                                    ////ctrl.Parent = null;
                                    ctrl.Dispose();
                                    ctrl = null;
                                }
                            }
                        }
                    }
                }
                #endregion

                if (false)
                {
                    ////String userControlName = typeof(UserControl1).Name;
                    String       userControlName   = typeof(ucVaginoscopeView).Name;
                    XtraFormBase newFormColpModule = newXtraFormBase(userControlName);

                    newcontrolcount++;
                    this.barStaticItemCount.Caption = newcontrolcount.ToString();

                    activeNavigationPage.SuspendLayout();
                    activeNavigationPage.Controls.Add((Control)(newFormColpModule));
                    newFormColpModule.Visible = true;
                    newFormColpModule.Dock    = DockStyle.Fill;
                    newFormColpModule.ResumeLayout(false);

                    activeNavigationPage.ResumeLayout(false);
                    activeNavigationPage.PerformLayout();
                }
            }
        }
Esempio n. 2
0
        private void navBarItem1_LinkClicked(object sender, NavBarLinkEventArgs e)
        {
            String methodname = new StackTrace(true).GetFrame(0).GetMethod().Name.ToString();

            Debug.WriteLine(methodname);

            Boolean formExist = false;

            if (sender is NavBarItem)
            {
                NavBarItem senderNavBarItem = sender as NavBarItem;
                ////var senderNavBarLink = e.Link;
                NavigationPage activeNavigationPage = (NavigationPage)navigationFrameMain.SelectedPage;

                ////if (senderNavBarItem == employeesNavBarItem || senderNavBarItem == customersNavBarItem)
                {
                    #region  Clear Form or Control
                    if (false)
                    {
                        foreach (var eachvar in navigationFrameMain.Controls)
                        {
                            if (eachvar is DevExpress.XtraBars.Navigation.NavigationPage)
                            {
                                DevExpress.XtraBars.Navigation.NavigationPage eachNavigationPage = eachvar as DevExpress.XtraBars.Navigation.NavigationPage;
                                if (eachNavigationPage == activeNavigationPage)
                                {
                                    while (eachNavigationPage.Controls.Count > 0)
                                    {
                                        var ctrl = eachNavigationPage.Controls[0];
                                        eachNavigationPage.Controls.RemoveAt(0);

                                        ctrl.BeginInvoke(new MethodInvoker(delegate
                                        {
                                            ////ctrl.Parent = null;
                                            if (ctrl is XtraFormBase)
                                            {
                                                (ctrl as XtraFormBase).Close();
                                            }
                                            if (ctrl != null)
                                            {
                                                ctrl.Dispose();
                                            }
                                        }));
                                        ctrl = null;
                                    }

                                    ////////foreach (var eachForm in eachNavigationPage.Controls)
                                    ////////{
                                    ////////    if (eachForm is XtraFormBase)
                                    ////////    {
                                    ////////        eachNavigationPage.Controls.Clear();
                                    ////////        ////(eachForm as XtraFormBase).Dispose();
                                    ////////        ////break;
                                    ////////    }
                                    ////////    else
                                    ////////    {
                                    ////////        eachNavigationPage.Controls.Clear();
                                    ////////    }
                                    ////////}
                                }
                            }
                        }
                    }
                    #endregion
                }
            }
        }
Esempio n. 3
0
        private void navBarItem_LinkClicked(object sender, NavBarLinkEventArgs e)
        {
            String methodname = new StackTrace(true).GetFrame(0).GetMethod().Name.ToString();

            Debug.WriteLine(methodname);

            Boolean formExist = false;

            if (sender is NavBarItem)
            {
                NavBarItem senderNavBarItem = sender as NavBarItem;
                ////var senderNavBarLink = e.Link;
                NavigationPage activeNavigationPage = (NavigationPage)navigationFrameMain.SelectedPage;

                ////if (senderNavBarItem == employeesNavBarItem || senderNavBarItem == customersNavBarItem)
                {
                    #region  Clear Form or Control
                    if (false)
                    {
                        foreach (var eachvar in navigationFrameMain.Controls)
                        {
                            if (eachvar is DevExpress.XtraBars.Navigation.NavigationPage)
                            {
                                DevExpress.XtraBars.Navigation.NavigationPage eachNavigationPage = eachvar as DevExpress.XtraBars.Navigation.NavigationPage;
                                if (eachNavigationPage == activeNavigationPage)
                                {
                                    while (eachNavigationPage.Controls.Count > 0)
                                    {
                                        var ctrl = eachNavigationPage.Controls[0];
                                        eachNavigationPage.Controls.RemoveAt(0);

                                        ctrl.BeginInvoke(new MethodInvoker(delegate
                                        {
                                            ////ctrl.Parent = null;
                                            if (ctrl is XtraFormBase)
                                            {
                                                (ctrl as XtraFormBase).Close();
                                            }
                                            if (ctrl != null)
                                            {
                                                ctrl.Dispose();
                                            }
                                        }));
                                        ctrl = null;
                                    }

                                    ////////foreach (var eachForm in eachNavigationPage.Controls)
                                    ////////{
                                    ////////    if (eachForm is XtraFormBase)
                                    ////////    {
                                    ////////        eachNavigationPage.Controls.Clear();
                                    ////////        ////(eachForm as XtraFormBase).Dispose();
                                    ////////        ////break;
                                    ////////    }
                                    ////////    else
                                    ////////    {
                                    ////////        eachNavigationPage.Controls.Clear();
                                    ////////    }
                                    ////////}
                                }
                            }
                        }
                    }
                    #endregion

                    #region  Add Form
                    if (false && formExist == false)
                    {
                        try
                        {
                            if (navigationFrameMain.Visible == false)
                            {
                                throw new NotSupportedException();
                            }
                            if (navigationFrameMain != null && !navigationFrameMain.IsDisposed)
                            {
                                {
                                    {
                                        if (activeNavigationPage.Controls.Count > 0)
                                        {
                                            throw new WarningException();
                                            ////activeNavigationPage.Controls.Clear();
                                        }
                                        String userControlName = typeof(UserControl1).Name;
                                        ////String userControlName = typeof(XtraUserControl).Name;
                                        XtraFormBase newFormColpModule = newXtraFormBase(userControlName);
                                        int          controlCount      = activeNavigationPage.Controls.Count;
                                        activeNavigationPage.Controls.Add((Control)(newFormColpModule));
                                        Debug.WriteLine($"{methodname} : {newFormColpModule}.{newFormColpModule} : {DateTime.Now.ToString(@"yyyy-MM-dd HH:mm:ss")}");

                                        newcontrolcount++;
                                        this.barStaticItemCount.Caption = newcontrolcount.ToString();

                                        activeNavigationPage.SuspendLayout();
                                        newFormColpModule.Visible = true;
                                        newFormColpModule.Dock    = DockStyle.Fill;
                                        newFormColpModule.ResumeLayout(false);
                                    }
                                    activeNavigationPage.ResumeLayout(false);
                                    activeNavigationPage.PerformLayout();
                                }
                            }
                        }
                        catch (Exception catchException)
                        {
                            throw (catchException);
                        }
                    }
                    #endregion
                }
            }
        }