Esempio n. 1
0
        /// <summary>
        /// Creates a modifyable list from a resource list and a factory that wraps the raw resources into resource objects.
        /// The set of modification operations supported on the list is defined by the delegates you provide for adding and removing the items.
        /// </summary>
        /// <param name="resources">The list of available resources, live or dead.</param>
        /// <param name="factory">The factory for wrapping the raw Omea resources into resource objects.</param>
        /// <param name="handlerAdd">A handler for adding new resources to the list. May be <c>Null</c>.</param>
        /// <param name="handlerRemove">A handler for adding new resources to the list. May be <c>Null</c>.</param>
        public ResourceObjectsList(IResourceList resources, IResourceObjectFactory <T> factory, EventHandler <ResourceObjectEventArgs> handlerAdd, EventHandler <ResourceObjectEventArgs> handlerRemove)
        {
            if (resources == null)
            {
                throw new ArgumentNullException("resources");
            }
            if (factory == null)
            {
                throw new ArgumentNullException("factory");
            }
            // Handlers may be Null

            _resources = resources;
            _factory   = factory;

            _handlerAdd    = handlerAdd;
            _handlerRemove = handlerRemove;
        }
Esempio n. 2
0
 /// <summary>
 /// Registers a new resource object factory.
 /// </summary>
 /// <typeparam name="TResourceObject">Type of the resource objects handled by the factory.</typeparam>
 /// <param name="factory">The factory object.</param>
 void ICoreEx.RegisterResourceObjectFactory <TResourceObject>(IResourceObjectFactory <TResourceObject> factory)
 {
     Core.PluginLoader.RegisterPluginService(factory);
 }
Esempio n. 3
0
 /// <summary>
 /// Registers a new resource object factory.
 /// </summary>
 /// <typeparam name="TResourceObject">Type of the resource objects handled by the factory.</typeparam>
 /// <param name="factory">The factory object.</param>
 public static void RegisterResourceObjectFactory <TResourceObject>(IResourceObjectFactory <TResourceObject> factory) where TResourceObject : IResourceObject
 {
     Instance.RegisterResourceObjectFactory(factory);
 }
Esempio n. 4
0
 /// <summary>
 /// Creates a list from a resource list and a factory that wraps the raw resources into resource objects.
 /// The standard Name property is used when looking for resources by their name.
 /// </summary>
 /// <param name="resources">The list of available resources, live or dead.</param>
 /// <param name="factory">The factory for wrapping the raw Omea resources into resource objects.</param>
 public ResourceObjectsListByName(IResourceList resources, IResourceObjectFactory <T> factory)
     : this(resources, factory, Core.Props.Name)
 {
 }
Esempio n. 5
0
 /// <summary>
 /// Creates a list from a resource list, a factory that wraps the raw resources into resource objects, and the name property name.
 /// </summary>
 /// <param name="resources">The list of available resources, live or dead.</param>
 /// <param name="factory">The factory for wrapping the raw Omea resources into resource objects.</param>
 /// <param name="sNamePropName">Name of the property that should be looked for when getting resources by name.</param>
 public ResourceObjectsListByName(IResourceList resources, IResourceObjectFactory <T> factory, string sNamePropName)
     : this(resources, factory, Core.ResourceStore.PropTypes[sNamePropName].Id)
 {
 }
Esempio n. 6
0
 /// <summary>
 /// Creates a list from a resource list, a factory that wraps the raw resources into resource objects, and the name property ID.
 /// </summary>
 /// <param name="resources">The list of available resources, live or dead.</param>
 /// <param name="factory">The factory for wrapping the raw Omea resources into resource objects.</param>
 /// <param name="nNamePropId">ID of the property that should be looked for when getting resources by name.</param>
 public ResourceObjectsListByName(IResourceList resources, IResourceObjectFactory <T> factory, int nNamePropId)
     : this(resources, factory, nNamePropId, null, null, null)
 {
 }
Esempio n. 7
0
 /// <summary>
 /// Creates a list from a resource list, a factory that wraps the raw resources into resource objects, and the name property ID.
 /// </summary>
 /// <param name="resources">The list of available resources, live or dead.</param>
 /// <param name="factory">The factory for wrapping the raw Omea resources into resource objects.</param>
 /// <param name="nNamePropId">ID of the property that should be looked for when getting resources by name.</param>
 /// <param name="handlerAdd">A handler for adding new resources to the list. May be <c>Null</c>.</param>
 /// <param name="handlerRemove">A handler for adding new resources to the list. May be <c>Null</c>.</param>
 /// <param name="handlerCreate">A handler for creating new resources and including them into the list. May be <c>Null</c>.</param>
 public ResourceObjectsListByName(IResourceList resources, IResourceObjectFactory <T> factory, int nNamePropId, EventHandler <ResourceObjectEventArgs> handlerAdd, EventHandler <ResourceObjectEventArgs> handlerRemove, EventHandler <ResourceObjectOutByNameEventArgs <T> > handlerCreate)
     : base(resources, factory, handlerAdd, handlerRemove)
 {
     _nNamePropId   = nNamePropId;
     _handlerCreate = handlerCreate;
 }
Esempio n. 8
0
 /// <summary>
 /// Creates a read-only list from a resource list and a factory that wraps the raw resources into resource objects.
 /// </summary>
 /// <param name="resources">The list of available resources, live or dead.</param>
 /// <param name="factory">The factory for wrapping the raw Omea resources into resource objects.</param>
 public ResourceObjectsList(IResourceList resources, IResourceObjectFactory <T> factory)
     : this(resources, factory, null, null)
 {
 }
Esempio n. 9
0
 public Enumerator(IEnumerator enumResources, IResourceObjectFactory <T> factory)
 {
     _enumResources = enumResources;
     _factory       = factory;
 }