// Non generic sources public static Synchronizer <Ta, object> SyncWith <Ta>(this IEditableCollection <Ta> collectionA, IEnumerable collectionB, Func <object, Ta> createA, Action <Ta> destroyA, Predicate <object> filterPredicate) { var target = new EditableCollectionTarget <Ta>(collectionA); var source = CreateNonGenericSource(collectionB); return(new Synchronizer <Ta, object>(target, source, createA, destroyA, filterPredicate)); }
public AuctionsController(IAuctionCollection auctions, IUserCollection users, IEditableCollection <Artist> artists, IEditableCollection <Gallery> galleries, IPaintingCollection paintings) { _auctions = auctions; _users = users; _artists = artists; _galleries = galleries; _paintings = paintings; }
public static void MarkOld(IEditableCollection collection) { if (collection == null) { return; } collection.MarkOld(); }
public static bool IsValid(IEditableCollection collection) { if (collection == null) { return(true); } return(collection.IsValid); }
// Non generic sources public static Synchronizer <Ta, object> SyncWith <Ta>(this IEditableCollection <Ta> collectionA, IEnumerable collectionB, Func <object, Ta> createA, Action <Ta> destroyA = null, Predicate <object> filterPredicate = null, SyncEventHandler <Ta, object> syncEventHandler = null) { var target = new EditableCollectionTarget <Ta>(collectionA); var source = CreateNonGenericSource(collectionB); destroyA = destroyA ?? RemoveAndDispose; filterPredicate = filterPredicate ?? DefaultFilterPredicate; return(new Synchronizer <Ta, object>(target, source, createA, destroyA, filterPredicate, syncEventHandler)); }
/// <summary> /// Merges state from source graph into target graph. /// </summary> /// <param name="target">Target of merge.</param> /// <param name="source">Source for merge.</param> private void MergeGraph(IEditableCollection target, IEditableCollection source) { var listType = target.GetType(); var childType = Utilities.GetChildItemType(listType); Reflection.MethodCaller.CallGenericMethod( this, "MergeBusinessListGraph", new [] { listType, childType }, true, target, source); }
/// <summary> /// Deserializes the content oft the XElement and adds the objects to the list /// </summary> /// <typeparam name="T">The type to deserialize and add to the list</typeparam> public static void DeserializeAndAddToList <T>(this XElement x, IEditableCollection <T> list, Serializer serializer) { if (x != null) { foreach (var item in x.Elements()) { list.Add(serializer.Deserialize <T>(item)); } } }
public ViewableCollection(IEditableCollection <T> collection) { FInternalCollection = collection; FInternalCollection.Added += InternalCollection_Added; FInternalCollection.Removed += InternalCollection_Removed; FInternalCollection.Cleared += InternalCollection_Cleared; FInternalCollection.UpdateBegun += InternalCollection_UpdateBegun; FInternalCollection.Updated += InternalCollection_Updated; }
/// <summary> /// Used by BusinessListBase as a child object is /// created to tell the child object about its /// parent. /// </summary> /// <param name="parent">A reference to the parent collection object.</param> internal void SetParent(IEditableCollection parent) { //COMMENT : We can have root objects in association collections /* * if (!IsChild) * throw new InvalidOperationException(Resources.ParentSetException); */ _parent = parent; }
public ArtistsController(IEditableCollection <Artist> artists, IFileManager fileManager, IAuctionCollection auctions, IPaintingCollection paintings, IUserCollection users) { _artists = artists; _auctions = auctions; _fileManager = fileManager; _paintings = paintings; _users = users; }
/// <summary> /// Merges state from source graph into target graph. /// </summary> /// <param name="target">Target of merge.</param> /// <param name="source">Source for merge.</param> private void MergeGraph(IEditableCollection target, IEditableCollection source) { #if !NETFX_CORE var listType = target.GetType(); var childType = Utilities.GetChildItemType(listType); var genericTypeParams = new Type[] { listType, childType }; var parameterTypes = new Type[] { listType, listType }; var methodReference = this.GetType().GetMethod("MergeBusinessListGraph"); var gr = methodReference.MakeGenericMethod(genericTypeParams); gr.Invoke(this, new object[] { target, source }); #endif }
public static T[] ToArray <T>(this IEditableCollection <T> collection) { var arr = new T[collection.Count]; int i = 0; foreach (var item in collection) { arr[i++] = item; } return(arr); }
public UserEditableChangeNotificationWrapper(IEditableCollection value, string sourceProperty) { _sourceProperty = sourceProperty; _sharedPropertyChangedEventHandler = ValueOnPropertyChanged; _sharedCollectionChangedEventHandler = ChangeNotificationWrapperOnCollectionChanged; value.CollectionChanged += _sharedCollectionChangedEventHandler; value.PropertyChanged += _sharedPropertyChangedEventHandler; /*value.ItemPropertyChanged += * ChangeNotificationWrapperOnCollectionItemPropertyChanged;*/ _sourceCollection = value; }
public static void RemoveRange <T>(this IEditableCollection <T> collection, IEnumerable items) { collection.BeginUpdate(); try { foreach (T item in items) { collection.Remove(item); } } finally { collection.EndUpdate(); } }
public static void AddRange <T>(this IEditableCollection <T> collection, IEnumerable <T> items) { collection.BeginUpdate(); try { foreach (var item in items) { collection.Add(item); } } finally { collection.EndUpdate(); } }
/// <summary> /// Merges state from source graph into target graph. /// </summary> /// <param name="target">Target of merge.</param> /// <param name="source">Source for merge.</param> private void MergeGraph(IEditableCollection target, IEditableCollection source) { #if !NETFX_CORE var listType = target.GetType(); var childType = Utilities.GetChildItemType(listType); var genericTypeParams = new Type[] { listType, childType }; var parameterTypes = new Type[] { listType, listType }; System.Reflection.MethodInfo methodReference; if (typeof(IExtendedBindingList).IsAssignableFrom(listType)) { methodReference = this.GetType().GetMethod("MergeBusinessBindingListGraph"); } else { methodReference = this.GetType().GetMethod("MergeBusinessListGraph"); } var gr = methodReference.MakeGenericMethod(genericTypeParams); gr.Invoke(this, new object[] { target, source }); #endif }
void IEditableBusinessObject.SetParent(IEditableCollection parent) { SetParent(parent); }
public static Synchronizer <Ta, object> SyncWith <Ta>(this IEditableCollection <Ta> collectionA, IEnumerable collectionB, Func <object, Ta> createA) { return(collectionA.SyncWith(collectionB, createA, RemoveAndDispose)); }
public static Synchronizer <Ta, object> SyncWith <Ta>(this IEditableCollection <Ta> collectionA, IEnumerable collectionB, Func <object, Ta> createA, Action <Ta> destroyA) { return(collectionA.SyncWith(collectionB, createA, destroyA, DefaultFilterPredicate)); }
public EditTreeValidator(IEditableCollection parentBusinessObjectList) { _parentBusinessObject = parentBusinessObjectList; }
public CollectorsController(IUserCollection users, IEditableCollection <Gallery> galleries, IPaintingCollection paintings) { _users = users; _galleries = galleries; _paintings = paintings; }
public EditableCollectionTarget(IEditableCollection <T> collection) { FCollection = collection; }
public GalleriesController(IEditableCollection <Gallery> artists, IUserCollection users, IPaintingCollection paintings) { _galleries = artists; _users = users; _paintings = paintings; }
/// <summary> /// Refreshes the control's property /// values to reflect the values of /// the underlying business object. /// </summary> public void Refresh() { // per-type rules if (DataObject != null) { Type sourceType = DataObject.GetType(); var newValue = Csla.Rules.BusinessRules.HasPermission(Rules.AuthorizationActions.CreateObject, DataObject); if (CanCreateObject != newValue) { CanCreateObject = newValue; } newValue = Csla.Rules.BusinessRules.HasPermission(Rules.AuthorizationActions.GetObject, DataObject); if (CanGetObject != newValue) { CanGetObject = newValue; } newValue = Csla.Rules.BusinessRules.HasPermission(Rules.AuthorizationActions.EditObject, DataObject); if (CanEditObject != newValue) { CanEditObject = newValue; } newValue = Csla.Rules.BusinessRules.HasPermission(Rules.AuthorizationActions.DeleteObject, DataObject); if (CanDeleteObject != newValue) { CanDeleteObject = newValue; } } else { CanCreateObject = false; CanGetObject = false; CanEditObject = false; CanDeleteObject = false; } IEditableBusinessObject source = DataObject as IEditableBusinessObject; if (source != null) { if (IsDeleted != source.IsDeleted) { IsDeleted = source.IsDeleted; } if (IsDirty != source.IsDirty) { IsDirty = source.IsDirty; } if (IsNew != source.IsNew) { IsNew = source.IsNew; } if (IsSavable != source.IsSavable) { IsSavable = source.IsSavable; } if (IsValid != source.IsValid) { IsValid = source.IsValid; } } else { IEditableCollection sourceList = DataObject as IEditableCollection; if (sourceList != null) { if (IsDirty != sourceList.IsDirty) { IsDirty = sourceList.IsDirty; } if (IsValid != sourceList.IsValid) { IsValid = sourceList.IsValid; } if (IsSavable != sourceList.IsSavable) { IsSavable = sourceList.IsSavable; } IsDeleted = false; IsNew = false; } } }
/// <summary> /// Refreshes the control's property /// values to reflect the values of /// the underlying business object. /// </summary> public void Refresh() { // per-type rules if (DataObject != null) { Type sourceType = DataObject.GetType(); if (CanCreateObject != YYT.Security.AuthorizationRules.CanCreateObject(sourceType)) { CanCreateObject = YYT.Security.AuthorizationRules.CanCreateObject(sourceType); } if (CanGetObject != YYT.Security.AuthorizationRules.CanGetObject(sourceType)) { CanGetObject = YYT.Security.AuthorizationRules.CanGetObject(sourceType); } if (CanEditObject != YYT.Security.AuthorizationRules.CanEditObject(sourceType)) { CanEditObject = YYT.Security.AuthorizationRules.CanEditObject(sourceType); } if (CanDeleteObject != YYT.Security.AuthorizationRules.CanDeleteObject(sourceType)) { CanDeleteObject = YYT.Security.AuthorizationRules.CanDeleteObject(sourceType); } } else { CanCreateObject = false; CanGetObject = false; CanEditObject = false; CanDeleteObject = false; } IEditableBusinessObject source = DataObject as IEditableBusinessObject; if (source != null) { if (IsDeleted != source.IsDeleted) { IsDeleted = source.IsDeleted; } if (IsDirty != source.IsDirty) { IsDirty = source.IsDirty; } if (IsNew != source.IsNew) { IsNew = source.IsNew; } if (IsSavable != source.IsSavable) { IsSavable = source.IsSavable; } if (IsValid != source.IsValid) { IsValid = source.IsValid; } } else { IEditableCollection sourceList = DataObject as IEditableCollection; if (sourceList != null) { if (IsDirty != sourceList.IsDirty) { IsDirty = sourceList.IsDirty; } if (IsValid != sourceList.IsValid) { IsValid = sourceList.IsValid; } if (IsSavable != sourceList.IsSavable) { IsSavable = sourceList.IsSavable; } IsDeleted = false; IsNew = false; } } }
public AuthenticationController(IUserCollection users, IEditableCollection <Gallery> galleries) { _users = users; _galleries = galleries; }