/// <summary> /// Initializes a new instance of PluginConnector /// </summary> /// <param name="moduleClient">The module client in the blackboard to connect with</param> public PluginConnector(IModuleClientPlugin moduleClient) { if (moduleClient == null) { throw new ArgumentNullException(); } this.moduleClient = moduleClient; moduleClient.ResponseReceived += new ResponseReceivedEH(ModuleClient_ResponseReceived); moduleClient.CommandReceived += new CommandReceivedEH(ModuleClient_CommandReceived); }
/// <summary> /// Attaches a IModuleClient object which will be used to communicate with blackboard /// </summary> /// <param name="moduleClient"></param> public void AttachClient(IModuleClientPlugin moduleClient) { if (CommandManager.IsRunning) { throw new ArgumentException("Cannot attach an IModuleClient object while the module is running"); } if (this.connector != null) { this.connector.Stop(); } if (moduleClient == null) { Stop(); } this.connector = new PluginConnector(moduleClient); this.CommandManager.Connector = this.connector; }