private void btnSelect_Click(object sender, EventArgs e) { // 用反射获得窗体 string assemblyName = "DotNet.WinForm"; string formName = "FrmUserSelect"; FrmUserSelect frmUserSelect = (FrmUserSelect)CacheManager.Instance.GetForm(assemblyName, formName); frmUserSelect.AllowNull = this.AllowNull; frmUserSelect.MultiSelect = this.MultiSelect; if (!String.IsNullOrEmpty(this.OpenId)) { frmUserSelect.OpenId = this.OpenId; } if (this.MultiSelect && this.SelectedIds != null) { frmUserSelect.SetSelectIds = this.SelectedIds; } frmUserSelect.PermissionItemScopeCode = this.PermissionItemScopeCode; if (frmUserSelect.ShowDialog() == DialogResult.OK) { this.SelectedId = frmUserSelect.SelectedId; this.SelectedFullName = frmUserSelect.SelectedFullName; this.txtFullName.Text = frmUserSelect.SelectedFullName; this.SelectedIds = frmUserSelect.SelectedIds; if (this.SelectedIndexChanged != null) { this.SelectedIndexChanged(this.SelectedId); } } this.SetControlState(); }
private void btnAddUser_Click(object sender, EventArgs e) { // 用反射获得窗体 FrmUserSelect frmUserSelect = new FrmUserSelect(); frmUserSelect.OnSelected += new FrmUserSelect.OnSelectedEventHandler(this.OnSelected); frmUserSelect.AllowNull = false; frmUserSelect.MultiSelect = true; frmUserSelect.PermissionItemScopeCode = this.PermissionItemScopeCode; frmUserSelect.RemoveIds = this.GetIds(); if (frmUserSelect.ShowDialog() == DialogResult.OK) { string[] selectedIds = ((FrmUserSelect)frmUserSelect).SelectedIds; if (selectedIds != null) { this.OnSelected(selectedIds); } } }