private ListForm CreateListForm(string formTypeName) { if (Database == null) { throw new NotImplementedException("Database property"); } Type type = Assembly.GetEntryAssembly().GetType(formTypeName); if (type == null || (type.BaseType.Name != "ListForm")) { throw new ArgumentException(EntryControl.Resources.Message.Error.WrongListForm); } ConstructorInfo constructor = type.GetConstructor(new Type[] { typeof(Database) }); if (constructor != null) { ListForm form = (ListForm)constructor.Invoke(new object[] { Database }); form.ItemSelected += new EventHandler(formItemSelected); return(form); } return(null); }
private void RaiseShowListForm(ListForm form) { if (onShowListForm != null) { onShowListForm(this, new ReferenceBoxEventArgs(form)); } }
private void btnShowListForm_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(ListForm)) { ListForm form = CreateListForm(ListForm); form.SelectedItem = SelectedItem; RaiseShowListForm(form); form.Show(); } else { throw new NotImplementedException("ListForm property"); } }
public ReferenceBoxEventArgs(ListForm form) : base() { Form = form; }