/// <summary>
        /// 
        /// </summary>
        /// <param name="dm"></param>
        /// <param name="windowName"></param>
        /// <param name="presetValues"></param>
        /// <returns></returns>
        public static ArchiveCheckForm Execute(IDisplayManager dm, string windowName, Dictionary<string, object> presetValues)
        {
            ArchiveCheckForm checkForm = new GeneratedArchiveCheckForm(ADInfoBll.Instance.GetWindowInfo(windowName));

            return Execute(dm, checkForm, presetValues);
        }
        /// <summary>
        /// CreateWindow
        /// </summary>
        /// <param name="windowInfo"></param>
        /// <returns></returns>
        public object CreateWindow(WindowInfo windowInfo)
        {
            MyForm returnForm = null;
            switch (windowInfo.WindowType)
            {
                case WindowType.Maintain:
                case WindowType.Transaction:
                    {
                        returnForm = new GeneratedArchiveOperationForm(windowInfo);
                    }
                    break;
                case WindowType.Query:
                    {
                        // decide gridType
                        IList<WindowTabInfo> tabInfos = ADInfoBll.Instance.GetWindowTabInfosByWindowId(windowInfo.Name);
                        IList<GridColumnInfo> gridColumns = ADInfoBll.Instance.GetGridColumnInfos(tabInfos[0].GridName);
                        foreach (GridColumnInfo info in gridColumns)
                        {
                            if (!string.IsNullOrEmpty(info.ParentPropertyName))
                            {
                                returnForm = new GeneratedArchiveSeeForm(windowInfo, DataGridType.DataUnboundGridLoadOnce);
                            }
                        }
                        returnForm = new GeneratedArchiveSeeForm(windowInfo);
                    }
                    break;
                case WindowType.QueryBound:
                    {
                        returnForm = new GeneratedArchiveSeeForm(windowInfo, DataGridType.DataBoundGridLoadOnDemand);
                    }
                    break;
                case WindowType.TransactionBound:
                    {
                        returnForm = new GeneratedArchiveOperationForm(windowInfo, ArchiveGridType.ArchiveBoundGrid);
                    }
                    break;
                case WindowType.Select:
                    {
                        returnForm = new GeneratedArchiveCheckForm(windowInfo);
                    }
                    break;
                case WindowType.DatabaseReport:
                    {
                        returnForm = new GeneratedArchiveDatabaseReportForm(windowInfo);
                    }
                    break;
                case WindowType.DataSetReport:
                    {
                        returnForm = new GeneratedArchiveDataSetReportForm(windowInfo);
                    }
                    break;
                case WindowType.SelectWindow:
                    {
                        using (ArchiveSelectForm selectForm = new ArchiveSelectForm(windowInfo.Name))
                        {
                            if (selectForm.ShowDialog() == DialogResult.OK)
                            {
                                returnForm = selectForm.SelectedForm;
                            }
                            else
                            {
                                returnForm = null;
                            }
                        }
                    }
                    break;
                case WindowType.DetailTransaction:
                    {
                        ArchiveDetailForm form = ArchiveFormFactory.GenerateArchiveDetailForm(ADInfoBll.Instance.GetWindowInfo(windowInfo.Name), null);
                        form.Load += new EventHandler(delegate(object sender, System.EventArgs e)
                        {
                            form.UpdateContent();
                            form.SetMenuState();
                        });
                        form.SetAsMdiChild();
                        //// 创建TaskPane
                        //GridRelatedControl gridRelatedControl = null;
                        //form.SetGridRelatedPanel(() =>
                        //    {
                        //        if (gridRelatedControl == null)
                        //        {
                        //            gridRelatedControl = new GridRelatedControl(form.GridName, form.DisplayManager, form);
                        //        }
                        //        return gridRelatedControl;
                        //    });

                        form.GenerateWindowMenu(ADInfoBll.Instance.GetWindowMenuInfo(windowInfo.Name));
                        form.Disposed += new EventHandler(delegate(object sender, System.EventArgs e)
                        {
                            form.DisposeWindowMenu();
                        });
                        returnForm = form;
                    }
                    break;
                case WindowType.DataControl:
                    {
                        returnForm = new GeneratedArchiveDataControlForm(windowInfo);
                    }
                    break;
                case WindowType.ExcelOperation:
                    {
                        returnForm = new GeneratedArchiveExcelForm(windowInfo);
                    }
                    break;
                default:
                    throw new ArgumentException("Invalid WindowType in WindowInfo");
            }

            if (WindowCreated != null)
            {
                WindowCreated(returnForm, System.EventArgs.Empty);
            }

            return returnForm;
        }