public Task <IRelayModule> GetModuleAsync()
 {
     if (_module == null)
     {
         _module = new SerialRelayModule();
     }
     return(Task.FromResult(_module));
 }
Example #2
0
 private async void PluginLoader_PluginLoaded(object sender, Modularity.IPlugin e)
 {
     BlindsAttached = _core.PluginLoader.GetPlugins <IRelayModulePlugin>().Any(p => p.GetType().Name == "FtdiPlugin");
     if (BlindsAttached)
     {
         _blindsModule = await _core.PluginLoader.GetPlugins <IRelayModulePlugin>().First(p => p.GetType().Name == "FtdiPlugin").GetModuleAsync();
     }
     NurseCallAttached = _core.PluginLoader.GetPlugins <IRelayModulePlugin>().Any(p => p.GetType().Name == "SerialRelayPlugin");
     if (NurseCallAttached)
     {
         _nurseModule = await _core.PluginLoader.GetPlugins <IRelayModulePlugin>().First(p => p.GetType().Name == "SerialRelayPlugin").GetModuleAsync();
     }
 }
Example #3
0
 public RelayManager(PanaceaServices core)
 {
     _core = core;
     _core.PluginLoader.PluginLoaded   += PluginLoader_PluginLoaded;
     _core.PluginLoader.PluginUnloaded += PluginLoader_PluginUnloaded;
     BlindsAttached = _core.PluginLoader.GetPlugins <IRelayModulePlugin>().Any(p => p.GetType().Name == "FtdiPlugin");
     if (BlindsAttached)
     {
         _core.PluginLoader.GetPlugins <IRelayModulePlugin>().First(p => p.GetType().Name == "FtdiPlugin").GetModuleAsync()
         .ContinueWith(task => _blindsModule = task.Result);
     }
     NurseCallAttached = _core.PluginLoader.GetPlugins <IRelayModulePlugin>().Any(p => p.GetType().Name == "SerialRelayPlugin");
     if (NurseCallAttached)
     {
         _core.PluginLoader.GetPlugins <IRelayModulePlugin>().First(p => p.GetType().Name == "SerialRelayPlugin").GetModuleAsync()
         .ContinueWith(task => _nurseModule = task.Result);
     }
 }