BUG01:打开子窗体(sender as ToolStripMenuItem)是null,取不到权限
BUG01:打开子窗体(sender as ToolStripMenuItem)是null,取不到权限今天在测试权限管理时找到一个BUG, 菜单的Click事件sender参数为null, 于是
sender as ToolStripMenuItem转换后的值也是null, 在OpenChildForm方法内的
IPurviewControllable 接口无法取到权限值.
//错误的写法
private void menuSalesOrder_Click(object sender, EventArgs e)
{
MdiTools.OpenChildForm(this.MdiParent as IMdiForm, typeof(frmSO), sender as ToolStripMenuItem);
}
//正确的写法
private void menuSalesOrder_Click(object sender, EventArgs e)
{
MdiTools.OpenChildForm(this.MdiParent as IMdiForm, typeof(frmSO), menuSalesOrder); //指定菜单名
}