示例#1
0
        private void neuButton1_Click(object sender, EventArgs e)
        {
            Neusoft.HISFC.Models.Admin.SysMenu obj = new Neusoft.HISFC.Models.Admin.SysMenu();
            obj.ModelFuntion.DllName             = this.txtDllName.Text;
            obj.ModelFuntion.WinName             = this.cmbFormName.Text;
            obj.MenuParm                         = this.txtTag.Text;
            obj.ModelFuntion.TreeControl.WinName = this.cmbTree.Text;
            obj.ModelFuntion.TreeControl.DllName = this.txtDllName.Text;
            obj.ModelFuntion.FormShowType        = this.cmdShowType.Text;
            ToolStripMenuItem menu = new ToolStripMenuItem();

            menu.Text = "²âÊÔ";
            menu.Tag  = obj;
            HIS.Menu.MenuClick(menu, null);
            this.Close();
        }
示例#2
0
        private void mnuShow_Click_1(object sender, EventArgs e)
        {
            if (this.fpSpread1_Sheet1.ActiveRowIndex < 0)
            {
                return;
            }

            int row = this.fpSpread1_Sheet1.ActiveRowIndex;

            if (this.fpSpread1_Sheet1.Cells[row, 5].Text == "Form" || this.fpSpread1_Sheet1.Cells[row, 5].Text == "")
            {
                Neusoft.HISFC.Models.Admin.SysMenu obj = new Neusoft.HISFC.Models.Admin.SysMenu();
                obj.ModelFuntion.DllName             = this.fpSpread1_Sheet1.Cells[row, 3].Text;
                obj.ModelFuntion.WinName             = this.fpSpread1_Sheet1.Cells[row, 2].Text;
                obj.MenuParm                         = this.fpSpread1_Sheet1.Cells[row, 7].Text;
                obj.MenuName                         = this.fpSpread1_Sheet1.Cells[row, 1].Text;
                obj.ModelFuntion.FormShowType        = this.fpSpread1_Sheet1.Cells[row, 4].Text;
                obj.ModelFuntion.TreeControl.WinName = this.fpSpread1_Sheet1.Cells[row, 9].Text;
                obj.ModelFuntion.TreeControl.DllName = this.fpSpread1_Sheet1.Cells[row, 8].Text;
                obj.ModelFuntion.TreeControl.Param   = this.fpSpread1_Sheet1.Cells[row, 10].Text;
                obj.MenuWin = this.fpSpread1_Sheet1.Cells[row, 11].Text;
                Classes.Function.ShowForm(obj);
            }
        }
示例#3
0
        private void mnuTest_Click(object sender, EventArgs e)
        {
            if (this.fpSpread1_Sheet1.ActiveRowIndex < 0)
            {
                return;
            }

            int row = this.fpSpread1_Sheet1.ActiveRowIndex;


            Neusoft.HISFC.Models.Admin.SysMenu obj = new Neusoft.HISFC.Models.Admin.SysMenu();
            obj.ModelFuntion.DllName = this.fpSpread1_Sheet1.Cells[row, 4].Text;
            obj.ModelFuntion.WinName = this.fpSpread1_Sheet1.Cells[row, 5].Text;
            obj.MenuParm             = this.fpSpread1_Sheet1.Cells[row, 11].Text;
            obj.MenuName             = this.fpSpread1_Sheet1.Cells[row, 1].Text;
            #region {CCC3E877-ADB8-43e5-80B5-53FDEE94C47E}
            obj.ModelFuntion.FormShowType = this.fpSpread1_Sheet1.Cells[row, 7].Text;
            #endregion
            obj.ModelFuntion.TreeControl.WinName = this.fpSpread1_Sheet1.Cells[row, 17].Text;
            obj.ModelFuntion.TreeControl.DllName = this.fpSpread1_Sheet1.Cells[row, 16].Text;
            //obj.ModelFuntion.TreeControl.Param = this.fpSpread1_Sheet1.Cells[row, 5].Text;
            //obj.MenuWin = this.fpSpread1_Sheet1.Cells[row, 11].Text;
            Function.ShowForm(obj);
        }
示例#4
0
        public static void ShowForm(Neusoft.HISFC.Models.Admin.SysMenu obj)
        {
            if (obj == null)
            {
                return;
            }

            string dllName  = obj.ModelFuntion.DllName + ".dll";
            string formName = obj.ModelFuntion.WinName.TrimStart().TrimEnd();
            string tag      = obj.MenuParm;
            string param    = "";
            string showType = obj.ModelFuntion.FormShowType;
            string tree     = obj.ModelFuntion.TreeControl.WinName;
            string treeDll  = obj.ModelFuntion.TreeControl.DllName + ".dll";
            string treeTag  = obj.ModelFuntion.TreeControl.Param;


            if (formName == "")
            {
                return;
            }

            if (formName.IndexOf(" ") >= 0)
            {
                param    = formName.Substring(formName.IndexOf(" ") + 1).TrimStart();
                formName = formName.Substring(0, formName.IndexOf(" "));
            }

            System.Windows.Forms.Control form     = null;
            System.Reflection.Assembly   assembly = null;

            switch (obj.MenuWin)//特殊窗口
            {
            case "Test":

                return;

            case "Register":

                return;

            case "Help":

                return;

            case "ChangePWD":
                /*应该实现代码*/
                return;

            case "Exit":

                return;

            default:     //其它窗口
                Object[] objParam = null;
                if (param != "")
                {
                    objParam    = new object[0];
                    objParam[0] = param;
                }
                try
                {
                    assembly = System.Reflection.Assembly.LoadFrom(dllName);
                    Type type = assembly.GetType(formName);
                    if (type == null)
                    {
                        MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("创建窗体出错!\n") + formName);
                        return;
                    }
                    System.Object objHandle = System.Activator.CreateInstance(type, objParam);
                    form     = objHandle as Control;
                    form.Tag = tag;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("创建窗体出错!\n") + ex.Message);
                    return;
                }

                break;
            }

            Neusoft.FrameWork.WinForms.Forms.IMaintenanceControlable iQueryControl = form as Neusoft.FrameWork.WinForms.Forms.IMaintenanceControlable;
            if (iQueryControl != null) //维护查询窗口
            {
                form = new Neusoft.FrameWork.WinForms.Forms.frmQuery(iQueryControl);
                //将菜单的名称付给窗口的名称
                form.Text = obj.MenuName;
            }

            Neusoft.FrameWork.WinForms.Forms.IControlable iControlable = form as Neusoft.FrameWork.WinForms.Forms.IControlable;
            if (iControlable != null) //功能窗口
            {
                //添加树
                System.Windows.Forms.TreeView tv = null;
                if (tree.Trim() != "")
                {
                    assembly = System.Reflection.Assembly.LoadFrom(treeDll);
                    tv       = AddTree(tree, assembly, tv);
                }
                if (tv == null)
                {
                    form = new Neusoft.FrameWork.WinForms.Forms.frmBaseForm(form);
                }
                else
                {
                    tv.Tag = treeTag;
                    form   = new Neusoft.FrameWork.WinForms.Forms.frmBaseForm(form, tv);
                }
                //将菜单的名称付给窗口的名称
                form.Text = obj.MenuName;
            }

            Type typeSender = form.GetType();

            if (typeSender.IsSubclassOf(typeof(Neusoft.FrameWork.WinForms.Forms.frmBaseForm)) || typeSender == typeof(Neusoft.FrameWork.WinForms.Forms.frmBaseForm))
            {
                ((Neusoft.FrameWork.WinForms.Forms.frmBaseForm)form).SetFormID(obj.MenuWin);
            }

            switch (showType)
            {
            case "FormDialog":
                ((Form)form).ShowDialog();
                break;

            case "Web":
                try
                {
                    System.Diagnostics.Process.Start("iexplore.exe", formName);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                break;

            default:
                ((Form)form).ShowDialog();
                break;
            }
        }