/// <summary> /// 新增 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAdd_Click(object sender, EventArgs e) { FrmUnitInfo fUnit = new FrmUnitInfo(); fUnit.Tag = new FInfoModel() { ActType = 1, UName = uName, FId = 0 }; fUnit.ReLoadHandler += LoadUnitList; fUnit.ShowDialog(); }
/// <summary> /// 显示单位信息页面(新增、修改、详情) /// </summary> /// <param name="actType">1 add 2 edit 4 info</param> /// <param name="unitId"></param> private void ShowUnitInfoPage(int actType, int unitId) { //acttype id uname (reload刷新列表数据) //另一种刷新:利用事件 为信息页面定义一个事件 FrmUnitInfo fUnitInfo = new FrmUnitInfo(); fUnitInfo.Tag = new FInfoModel() { ActType = actType, FId = unitId, UName = uName }; if (actType != 4) { fUnitInfo.ReLoadHandler += LoadUnitList;//订阅 并不是每种都需要刷新 } fUnitInfo.ShowDialog(); }