Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 private void RaiseShowListForm(ListForm form)
 {
     if (onShowListForm != null)
     {
         onShowListForm(this, new ReferenceBoxEventArgs(form));
     }
 }
Exemplo n.º 3
0
 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");
     }
 }
Exemplo n.º 4
0
 public ReferenceBoxEventArgs(ListForm form)
     : base()
 {
     Form = form;
 }