private static void OnInitializeEditView(IDataSource childDataSource, PropertyEditorItem editPropertyItem) { childDataSource.SuspendUpdate(); childDataSource.SetEditMode(); childDataSource.ResumeUpdate(); childDataSource.SetSelectedItem(editPropertyItem.Item); }
private bool DeleteProperty(PropertyEditorItem propertyItem) { var propertyEditor = propertyItem.Editor; var deletePropertyFunc = IsCollectionProperty(propertyEditor) ? DeleteCollectionProperty(_propertyItems, propertyEditor) : DeleteScalarProperty(_propertyItems, propertyEditor); return(deletePropertyFunc(propertyItem)); }
private bool UpdateProperty(PropertyEditorItem oldPropertyItem, PropertyEditorItem newPropertyItem) { var propertyEditor = newPropertyItem.Editor; var updatePropertyFunc = IsCollectionProperty(propertyEditor) ? UpdateCollectionProperty(_propertyItems, propertyEditor) : UpdateScalarProperty(_propertyItems, propertyEditor); return(updatePropertyFunc(oldPropertyItem, newPropertyItem)); }
private bool InsertProperty(PropertyEditorItem propertyItem) { var propertyEditor = propertyItem.Editor; var insertPropertyFunc = IsCollectionProperty(propertyEditor) ? InsertCollectionProperty(_propertyItems, propertyEditor) : InsertScalarProperty(_propertyItems, propertyEditor); return(insertPropertyFunc(propertyItem)); }
private void OnAcceptedEditView(bool isNewPropertyItem, PropertyEditorItem propertyItem, PropertyEditorItem editPropertyItem) { var isEditValueChanged = isNewPropertyItem ? InsertProperty(editPropertyItem) : UpdateProperty(propertyItem, editPropertyItem); if (isEditValueChanged) { InvokeEditValueChanged(EditValue, EditValue); } }
private void AddOrEditProperty(PropertyEditorItem propertyItem, bool isNewPropertyItem) { if (propertyItem != null) { var editPropertyItem = isNewPropertyItem ? propertyItem : propertyItem.Clone(); ViewHelper.ShowView(propertyItem, () => propertyItem.Editor.EditView, childDataSource => OnInitializeEditView(childDataSource, editPropertyItem), childDataSource => OnAcceptedEditView(isNewPropertyItem, propertyItem, editPropertyItem)); } }
private void SetSelectedProperty(PropertyEditorItem propertyItem) { Editor.EditValue = propertyItem; }
private void EditProperty(PropertyEditorItem propertyItem) { AddOrEditProperty(propertyItem, false); }