/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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; }
/// <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; }