Exemplo n.º 1
0
 private void menuSpecNew_Click(object sender, EventArgs e)
 {
     Spec.MainForm form = null;
     foreach (var f in this.MdiChildren)
     {
         if (f is Spec.MainForm)
         {
             form = f as Spec.MainForm;
             break;
         }
     }
     if (form == null)
     {
         form = new Spec.MainForm()
         {
             MdiParent = this
         }
     }
     ;
     form.WindowState = FormWindowState.Maximized;
     form.Show();
 }
Exemplo n.º 2
0
        void MainForm_Load(object sender, EventArgs e)
        {
            var user = Common.LogonUser;

            //加载模块
            var license = Serialize.Read <ChemLicense>(MyLicenseProvider.LicenseFullPath);

            if (license != null && license.Model != null)
            {
                var m = license.Model;
                this.menuB.Visible     = m.Bind;
                this.menuF.Visible     = m.Fit;
                this.menuId.Visible    = m.Identify;
                this.menuM.Visible     = m.Maintain;
                this.menuMix.Visible   = m.Mix;
                this.menuModel.Visible = m.Model;
                this.menuSpec.Visible  = m.Spec;
                this.menuP.Visible     = m.Predict;
            }

            if (user.RoleType == Roles.RoleName.Operator)
            {
                this.menuC.Visible = false;
            }

            //    ToolStripManager.Renderer = new RIPP.Lib.UI.Theme.Office2007Renderer();
            var r = user.Role;

            if (r != null)
            {
                //设置权限
                this.menuSpec.Visible     = r.Spec;
                this.menuSpecNew.Visible  = r.SpecNew;
                this.menuSpecOpen.Visible = r.SpecOpen;

                this.menuModel.Visible     = r.Model;
                this.menuModelNew.Visible  = r.ModelNew;
                this.menuModelOpen.Visible = r.ModelOpen;

                this.menuId.Visible     = r.Id;
                this.menuIdNew.Visible  = r.IdNew;
                this.menuIdOpen.Visible = r.IdOpen;

                this.menuF.Visible     = r.Fit;
                this.menuFNew.Visible  = r.FitNew;
                this.menuFOpen.Visible = r.FitOpen;

                this.menuB.Visible  = r.Pack;
                this.menuBB.Visible = r.Bind;
                this.menuBI.Visible = r.Integrate;

                this.menuP.Visible = r.Predict;

                this.menuMix.Visible = r.Mix;

                this.menuM.Visible  = r.Maintain;
                this.menuMI.Visible = r.MaintainId;
                this.menuMF.Visible = r.MaintainFit;
                this.menuMP.Visible = r.MaintainPLS;

                this.menuCRole.Visible = user.RoleType == Roles.RoleName.RIPP;


                var form = new Spec.MainForm()
                {
                    MdiParent = this
                };
                form.WindowState = FormWindowState.Maximized;
                form.Show();
            }
        }