public static void OpenAllMenus()
        {
            TabbedMdiForm mdiForm = ServiceProvider.GetService <IApplication>() as TabbedMdiForm;

            if (mdiForm == null)
            {
                return;
            }

            try
            {
                foreach (ToolStripMenuItem menuItem in mdiForm.MainMenuStrip.Items)
                {
                    if (menuItem.Text == "功能(&F)")
                    {
                        //Thread t = new Thread(new ParameterizedThreadStart(PerformClickMenu));
                        //t.Start(menuItem);
                        PerformClickMenu(menuItem);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionProcess.ProcessWithNotify(ex);
            }
        }
        private static void PerformClickMenu(object o)
        {
            ToolStripMenuItem menuItem = o as ToolStripMenuItem;

            if (menuItem.Text.Contains("忽略"))
            {
                return;
            }

            menuItem.PerformClick();

            TabbedMdiForm mdiForm = ServiceProvider.GetService <IApplication>() as TabbedMdiForm;

            try
            {
                foreach (Form form in mdiForm.MdiChildren)
                {
                    if (form is ArchiveSeeForm)
                    {
                        (form as ArchiveSeeForm).DisplayManager.SearchManager.LoadDataAccordSearchControls();
                        if ((form as ArchiveSeeForm).DisplayManager.Count > 0 &&
                            (form as ArchiveSeeForm).ArchiveDetailForm != null)
                        {
                            (form as ArchiveSeeForm).DoView();
                        }
                    }
                    //if (form is ArchiveOperationForm)
                    //{
                    //    (form as ArchiveOperationForm).DoAdd();
                    //}
                }

                foreach (Form form in mdiForm.MdiChildren)
                {
                    form.Close();
                    form.Dispose();
                }

                if (menuItem is ToolStripDropDownItem)
                {
                    foreach (ToolStripMenuItem subItem in ((ToolStripDropDownItem)menuItem).DropDownItems)
                    {
                        PerformClickMenu(subItem);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionProcess.ProcessWithNotify(new ArgumentException(menuItem.Text + "出错", ex));
            }
        }
示例#3
0
        private void tsbSearch_Click(object sender, EventArgs e)
        {
            TabbedMdiForm mdiForm = ServiceProvider.GetService <IApplication>() as TabbedMdiForm;
            bool          ret     = false;

            if (mdiForm != null && this.IsMdiChild)
            {
                ret = mdiForm.ShowSearchToolWindow();
            }
            if (!ret)
            {
                ShowSearchDialog(this.GetSearchPanel(), this.DisplayManager.SearchManager, this.Name);
            }
        }