Example #1
0
 private static void ThrowConfigException(IBaseObject item, string type, string message)
 {
     if (type == null)
     {
         type = item.GetType().ToString();
     }
     throw new Exception(string.Format("{0} {1}", type, message));
 }
Example #2
0
        private void ButtonEditObject_Click(object sender, EventArgs e)
        {
            IBaseObject @object = Data.objects.Where(obj => obj.GetType() == ObjectType).First(obj => obj.GetId() == ListView.SelectedItems[0].SubItems[0].Text);

            foreach (Control control in Controls)
            {
                if (!InitializeObject(ref @object, control))
                {
                    return;
                }
            }
            MessageBox.Show((@object.GetType().GetCustomAttribute(typeof(DescriptionAttribute)) as DescriptionAttribute).Description + " has successfully edited!");
            Data.FillListView(ListView);
            Dispose();
        }
Example #3
0
        private void ButtonAddObject_Click(object sender, EventArgs e)
        {
            IBaseObject @object = (IBaseObject)Activator.CreateInstance(ObjectType);

            foreach (Control control in Controls)
            {
                if (!InitializeObject(ref @object, control))
                {
                    return;
                }
            }
            Data.objects.Add(@object);
            MessageBox.Show((@object.GetType().GetCustomAttribute(typeof(DescriptionAttribute)) as DescriptionAttribute).Description + " has successfully added!");
            Data.FillListView(ListView);
            Dispose();
        }