示例#1
0
文件: Receptors.cs 项目: babann/HOPE
        /// <summary>
        /// Add an existing implementor of IReceptorInstance.  Call this method when registering
        /// application-level instances that are themselves receptors, such as models, controllers,
        /// views, etc.
        /// </summary>
        public void RegisterReceptor(string name, IReceptorInstance inst)
        {
            Receptor r = new Receptor(name, inst);

            r.EnabledStateChanged += WhenEnabledStateChanged;
            receptors.Add(r);
        }
示例#2
0
文件: Receptors.cs 项目: babann/HOPE
        /// <summary>
        /// Register a receptor given just the assembly filename.  The receptor assembly must still be loaded
        /// by calling LoadReceptors.  Used for registering receptors in a batch before instantiating them.
        /// </summary>
        /// <param name="filename"></param>
        public IReceptor RegisterReceptor(string filename)
        {
            Receptor r = Receptor.FromFile(filename).Instantiate(this);

            receptors.Add(r);

            return(r);
        }
示例#3
0
文件: Receptors.cs 项目: babann/HOPE
        /// <summary>
        /// Adds a receptor definition to the collection.  Call this method when mass-loading
        /// receptors with their names and implementing assembly names, say from an XML file.
        /// </summary>
        public Receptor RegisterReceptor(string receptorName, string assemblyName)
        {
            Receptor r = new Receptor(receptorName, assemblyName);

            r.EnabledStateChanged += WhenEnabledStateChanged;
            receptors.Add(r);

            return(r);
        }
示例#4
0
文件: Receptor.cs 项目: babann/HOPE
        /// <summary>
        /// Factory method for creating a receptor from a given assembly filename.
        /// </summary>
        public static Receptor FromFile(string filename)
        {
            string   name     = Path.GetFileNameWithoutExtension(filename).SplitCamelCase();
            Assembly assembly = Assembly.LoadFile(filename);

            Receptor r = new Receptor(name, assembly);

            r.AssemblyName = Path.GetFileName(filename);

            return(r);
        }
示例#5
0
		/// <summary>
		/// Add an existing implementor of IReceptorInstance.  Call this method when registering
		/// application-level instances that are themselves receptors, such as models, controllers,
		/// views, etc.
		/// </summary>
		public void RegisterReceptor(string name, IReceptorInstance inst)
		{
			Receptor r = new Receptor(name, inst);
			r.EnabledStateChanged += WhenEnabledStateChanged;
			receptors.Add(r);
		}
示例#6
0
		/// <summary>
		/// Adds a receptor definition to the collection.  Call this method when mass-loading
		/// receptors with their names and implementing assembly names, say from an XML file.
		/// </summary>
		public Receptor RegisterReceptor(string receptorName, string assemblyName)
		{
			Receptor r = new Receptor(receptorName, assemblyName);
			r.EnabledStateChanged += WhenEnabledStateChanged;
			receptors.Add(r);

			return r;
		}
示例#7
0
		/// <summary>
		/// Factory method for creating a receptor from a given assembly filename.
		/// </summary>
		public static Receptor FromFile(string filename)
		{
			string name = Path.GetFileNameWithoutExtension(filename).SplitCamelCase();
			Assembly assembly = Assembly.LoadFile(filename);

			Receptor r = new Receptor(name, assembly);
			r.AssemblyName = Path.GetFileName(filename);

			return r;
		}