Esempio n. 1
0
 public static IEnumerable<EFDataUnit> ExtractDataUnitFromPanel(DataContainerLayoutPanel panel)
 {
     var result = new List<EFDataUnit>();
     foreach (var container in panel.Controls.OfType<DataControl.DataContainer>())
     {
         container.UpdateDataUnitWithControlValue();
         if (container.Data.IsValid()) result.Add(container.Data as EFDataUnit);
     }
     return result;
 }
Esempio n. 2
0
 public static DataControl.DataContainer CreateDataUnitControl(IDataUnit dataUnit, bool editMode, DataContainerLayoutPanel panel)
 {
     var controlType = Type.GetType(dataUnit.ControlClassName);
     var result = Activator.CreateInstance(controlType)  as DataControl.DataContainer;
     result.Data = dataUnit;
     result.ShowEditItem = editMode;
     if (editMode)
     {
         result.UpClick += panel.OnUpClick;
         result.DownClick += panel.OnDownClick;
         result.DeleteClick += panel.OnDeleteClick;
     }
     return result;
 }
Esempio n. 3
0
 private static void UpdateLayoutPanelFromTemplate(EFTemplate template, DataContainerLayoutPanel panel, bool editMode)
 {
     foreach (var tmpl in template.Children)
     {
         UpdateLayoutPanel(tmpl.DataField, panel, editMode);
         UpdateLayoutPanelFromTemplate(tmpl, panel, editMode);
     }
 }
Esempio n. 4
0
 public static void UpdateLayoutPanel(IField field, DataContainerLayoutPanel panel, bool editMode)
 {
     var dataUnit = field.CreateDataUnit(!editMode);
     var dataUnitControl = DataUnitFactory.CreateDataUnitControl(dataUnit, editMode, panel);
     panel.Controls.Add(dataUnitControl);
 }
Esempio n. 5
0
 public static void BuildDataContainerFromTemplate(EFTemplate template, DataContainerLayoutPanel panel, bool editMode)
 {
     panel.Controls.Clear();
     UpdateLayoutPanelFromTemplate(template, panel, editMode);
 }