protected virtual void OnCommandsChanged(LMSCommands oldValue, LMSCommands newValue)
 {
     if (newValue != null)
     {
         btn_exit.Command = newValue.SearchDialogCommands.Cancel;
     }
     else
     {
         btn_exit.Command = null;
         //    btn_cancel.Command = null;
         //    btn_preview.Command = null;
         //    btn_print.Command = null;
         //    btn_reset.Command = null;
     }
 }
Beispiel #2
0
 protected virtual void OnCommandsChanged(LMSCommands oldValue, LMSCommands newValue)
 {
     if (newValue != null)
     {
         btn_save.Command    = newValue.LicenseCommands.Save;
         btn_cancel.Command  = newValue.LicenseCommands.Cancel;
         btn_preview.Command = newValue.LicenseCommands.Preview;
         btn_print.Command   = newValue.LicenseCommands.Print;
         btn_reset.Command   = newValue.LicenseCommands.Reset;
     }
     else
     {
         btn_save.Command    = null;
         btn_cancel.Command  = null;
         btn_preview.Command = null;
         btn_print.Command   = null;
         btn_reset.Command   = null;
     }
 }
Beispiel #3
0
        public frm_main(Users user)
        {
            InitializeComponent();
            InitLicenseList();

            this.Text = ConfigurationManager.AppSettings["appName"];
            _Commands = new LMSCommands();
            _Commands.LicenseCommands.New              = new Command(components); // We pass in components from Form so the command gets disposed automatically when form is disposed
            _Commands.LicenseCommands.New.Executed    += NewLicenseExecuted;
            _Commands.LicenseCommands.Cancel           = new Command(components);
            _Commands.LicenseCommands.Cancel.Executed += CancelLicenseExecuted;
            //_Commands.LicenseCommands.Save = new Command(components);
            //_Commands.LicenseCommands.Save.Executed += SaveClientExecuted;
            btn_newLicense.Command = _Commands.LicenseCommands.New;

            _Commands.LicenseCommands.Save                  = new Command(components);
            _Commands.LicenseCommands.Save.Executed        += SaveLicenseExecuted;
            _Commands.SearchDialogCommands.Open             = new Command(components);
            _Commands.SearchDialogCommands.Open.Executed   += CertificationSearchExcuted;
            _Commands.SearchDialogCommands.Cancel           = new Command(components);
            _Commands.SearchDialogCommands.Cancel.Executed += CancelSearchDialogExecuted;
            tile_certManage.Command = _Commands.SearchDialogCommands.Open;
            lb_indexTitle.Text     += user.Realname;
            lb_username.Text        = user.Username;
            lb_role.Text            = user.RoleName;
            currentUser             = user;
            if (user.RoleName.IndexOf("管理员") >= 0)
            {
                pictureBox1.Image = Properties.Resources.admin;
            }
            else
            {
                pictureBox1.Image = Properties.Resources.normal;
            }
            metroToolbar1.Location   = new Point((this.Width - metroToolbar1.Width) / 2, metroToolbar1.Parent.Height - metroToolbar1.Height - 1);
            metroTilePanel1.Location = new Point((this.Width - metroTilePanel1.Width) / 2, (this.Height - metroTilePanel1.Height) / 2);

            settingBll     = new SettingBLL();
            defaultSetting = settingBll.GetDefaultSetting();

            roleBll = new RoleBLL();
            role    = roleBll.GetRoleById(currentUser.RoleId);
            if (defaultSetting == null)
            {
                if (role.AdminFlag == 1)
                {
                    if (DialogResult.OK == MessageBoxEx.Show("未配置系统全局设定,请配置全局设定", "全局设定未配置", MessageBoxButtons.OK))
                    {
                        new frm_globalSetting().ShowDialog();
                    }
                    else
                    {
                        this.Close();
                    }
                }
                else
                {
                    if (DialogResult.OK == MessageBoxEx.Show("未配置系统全局设定,请联系管理员配置全局设定", "全局设定未配置", MessageBoxButtons.OK))
                    {
                        this.Close();
                    }
                    else
                    {
                        this.Close();
                    }
                }
            }
        }