示例#1
0
        public Thread SendData(string sender, string module, CommunicationData data)
        {
            var mod = Get(module);

            if (mod == null)
            {
                _logger.Warn($"Failed to send data to {module} because the module isn't loaded");
                return(null);
            }
            _logger.Info($"Send {data.Type} from {sender} to {module}");
            return(_threadHelper.RunSafeInNewThread(() =>
            {
                mod.ProcessDataFromOtherModule(sender, data);
            }, _logger));
        }
示例#2
0
        void Module_NewDataAvailable(object sender, CommunicationData newData)
        {
            var senderName = (sender as IModule)?.Name ?? "Unknown";

            foreach (var module in _modules)
            {
                //Skip the sender
                if (module.Name == senderName)
                {
                    continue;
                }
                //Inform all the modules, each in a own task

                _threadHelper.RunSafeInNewThread(() =>
                {
                    module.ProcessDataFromOtherModule(senderName, newData);
                }, _logger);
            }
            OnUpdate();
        }
示例#3
0
 public virtual void ProcessDataFromOtherModule(string moduleName, CommunicationData data)
 {
 }