/// <summary> /// Refresca el contenido del formulario. /// </summary> /// <param name="args">Los argumentos del hilo que carga.</param> protected override void Reload(LoaderArguments args) { DataModelManager modelManager = ((DataModelManager)Manager); modelManager.Clear(); foreach (DataModelEntity entity in args.Items) { modelManager.Add(entity); } }
/// <summary> /// Constructor de clase. /// </summary> /// <param name="control">Referencia al control que contiene este componente.</param> /// <param name="manager">Componente que muestra la lista de entidades.</param> /// <param name="editor">Componente que permite agregar o editar una entidad.</param> /// <param name="firstElement">Componente que debe enfocarse cuando el editor se muestra.</param> public DataModelController(UserControl1 control, DataModelManager manager, DataModelEditor editor, FrameworkElement firstElement) : base(control, manager, editor, firstElement, new LoadList(DataModelManager.Load), new SaveEntity(DataModelManager.Save), new RemoveEntity(DataModelManager.Delete)) { dataModelManager = (DataModelManager)manager; DataModelEditor addDataModel = (DataModelEditor)editor; addDataModel.OkSelected += OnOkSelected; addDataModel.CancelSelected += OnCancelSelected; dataModelManager.ItemList.NewButtonSelected += OnNewSelected; dataModelManager.ItemList.EditButtonSelected += OnEditSelected; dataModelManager.ItemList.DeleteButtonSelected += OnDeleteSelected; dataModelManager.ItemList.ExtraButtonSelected += OnExtraSelected; }