private object DispCreateNewObject(string type, string typeId) { switch (type) { case "Monitor": return(new Monitor()); case "Visual": HeliosVisual visual = ConfigManager.ModuleManager.CreateControl(typeId); visual.Dispatcher = _dispatcher; return(visual); case "Interface": HeliosInterfaceDescriptor descriptor = ConfigManager.ModuleManager.InterfaceDescriptors[typeId]; HeliosInterface heliosInterface = descriptor != null?descriptor.CreateInstance() : null; if (heliosInterface != null) { heliosInterface.Dispatcher = _dispatcher; } return(heliosInterface); case "Binding": return(new HeliosBinding()); } return(null); }
protected object CreateNewObject(string type, string typeId, ComponentUnsupportedSeverity ifUnsupported = ComponentUnsupportedSeverity.Error) { switch (type) { case "Monitor": return(new Monitor()); case "Visual": HeliosVisual visual = ConfigManager.ModuleManager.CreateControl(typeId); if (visual == null) { Logger.Error("Ignoring control not supported by this version of Helios: " + typeId); return(null); } return(visual); case "Interface": HeliosInterfaceDescriptor descriptor = ConfigManager.ModuleManager.InterfaceDescriptors[typeId]; if (descriptor == null) { switch (ifUnsupported) { case ComponentUnsupportedSeverity.Error: Logger.Error("Ignoring interface not supported by this version of Helios: {TypeId}; bindings to this interface will fail", typeId); return(null); case ComponentUnsupportedSeverity.Warning: Logger.Warn("Ignoring interface not supported by this version of Helios: {TypeId}; bindings to this interface will fail", typeId); return(null); case ComponentUnsupportedSeverity.Ignore: Logger.Info("Ignoring interface not supported by this version of Helios: {TypeId}; bindings to this interface will be silently ignored", typeId); // create a dummy interface that preserves the XML and ignores but allows writing of all bindings UnsupportedInterface dummy = new UnsupportedInterface(); dummy.RepresentedTypeIdentifier = typeId; // record interface type alias, but don't install it yet because we may read more instances of this interface // alias will allow resolution of the unsupported class to our dummy for use in places where we try to instantiate the editor HeliosInterfaceDescriptor dummyDescriptor = ConfigManager.ModuleManager.InterfaceDescriptors[UnsupportedInterface.TYPE_IDENTIFIER]; if (DiscoveredAliases != null) { DiscoveredAliases[typeId] = dummyDescriptor; } return(dummy); default: throw new ArgumentOutOfRangeException(nameof(ifUnsupported), ifUnsupported, null); } } return(descriptor.CreateInstance()); case "Binding": return(new HeliosBinding()); } return(null); }
private object DispCreateNewObject(string type, string typeId) { switch (type) { case "Monitor": return(new Monitor()); case "Visual": HeliosVisual visual = ConfigManager.ModuleManager.CreateControl(typeId); if (visual == null) { ConfigManager.LogManager.LogError("Ignoring control not supported by this version of Helios: " + typeId); return(null); } visual.Dispatcher = _dispatcher; return(visual); case "Interface": HeliosInterfaceDescriptor descriptor = ConfigManager.ModuleManager.InterfaceDescriptors[typeId]; if (descriptor == null) { ConfigManager.LogManager.LogError("Ignoring interface not supported by this version of Helios: " + typeId); return(null); } HeliosInterface heliosInterface = descriptor != null?descriptor.CreateInstance() : null; if (heliosInterface != null) { heliosInterface.Dispatcher = _dispatcher; } return(heliosInterface); case "Binding": return(new HeliosBinding()); } return(null); }