コード例 #1
0
        /// <summary>
        /// Initialize the linked lists and load the settings. This
        /// don't initialize the plugins, so no hardware resources
        /// are locked.
        /// </summary>
        private static void BuildControlStructure()
        {
            // Get all plugins
            List <IControlPlugin> pluginInstances = PluginInstances();

            // Initialize the arrays
            _plugins = new List <IControlPlugin>();
            _input   = new List <IControlInput>();
            _output  = new List <IControlOutput>();

            // Filter the ones that are enabled
            IEnumerator <IControlPlugin> pluginIterator = pluginInstances.GetEnumerator();

            while (pluginIterator.MoveNext())
            {
                // Get the settings interface
                IControlPlugin   plugin   = pluginIterator.Current;
                IControlSettings settings = plugin.Settings;
                if (null == settings)
                {
                    Log.Error("ControlDevices: Error getting IControlSettings of {0} in {1}", ((Type)plugin).FullName,
                              plugin.LibraryName);
                    continue;
                }
                // Load the settings
                settings.Load();

                if (settings.Enabled)
                {
                    if (settings.EnableInput)
                    {
                        IControlInput input = plugin.InputInterface;
                        if (null == input)
                        {
                            Log.Error("ControlDevices: Error getting IControlInput Interface of {0} in {1}", ((Type)plugin).FullName,
                                      plugin.LibraryName);
                            continue;
                        }
                        _input.Add(input);
                    }
                    if (settings.EnableOutput)
                    {
                        IControlOutput output = plugin.OutputInterface;
                        if (null == output)
                        {
                            Log.Error("ControlDevices: Error getting IControlOutput Interface of {0} in {1}", ((Type)plugin).FullName,
                                      plugin.LibraryName);
                            continue;
                        }
                        _output.Add(output);
                    }
                }
            }
        }
コード例 #2
0
 /// <summary>
 /// Adds the given element to the collection
 /// </summary>
 /// <param name="item">The item to add</param>
 public override void Add(IModelElement item)
 {
     if ((this._parent.CmdQual == null))
     {
         IControlOutput cmdQualCasted = item.As <IControlOutput>();
         if ((cmdQualCasted != null))
         {
             this._parent.CmdQual = cmdQualCasted;
             return;
         }
     }
 }
コード例 #3
0
 /// <summary>
 /// Creates a new observable property access proxy
 /// </summary>
 /// <param name="modelElement">The model instance element for which to create the property access proxy</param>
 public ValProxy(IControlOutput modelElement) :
     base(modelElement, "val")
 {
 }