Exemple #1
0
        /// <summary>
        /// Initializes the BrailleIO framework. Build a new BrailleIOAdapter_ShowOff, and add it to the IBrailleIOAdapterManager.
        /// </summary>
        /// <param name="adapterManager">The adapter manager to use for managing devices.</param>
        /// <param name="setAsActiveAdapter">if set to <c>true</c> [set this as active adapter].</param>
        /// <returns>
        /// The created BrailleIOAdapter_ShowOff, that was build with this instance
        /// </returns>
        public AbstractBrailleIOAdapterBase InitializeBrailleIO(IBrailleIOAdapterManager adapterManager, bool setAsActiveAdapter = false)
        {
            ShowOffAdapter       = new BrailleIOAdapter_ShowOff(adapterManager, this);
            ShowOffAdapter.Synch = true;

            adapterManager.AddAdapter(ShowOffAdapter);

            return(ShowOffAdapter);
        }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BrailleIOAdapter_ShowOff"/> class.
 /// </summary>
 /// <param name="manager">The IBrailleIOAdapterManager the device hase to be registerd to.</param>
 public BrailleIOAdapter_ShowOff(IBrailleIOAdapterManager manager)
     : base(manager)
 {
     this.manager = manager;
     this.Device  = new BrailleIODevice(120, 60, "ShowOFF_" + this.GetHashCode(), true, false, 30, this);
     if (manager != null)
     {
         manager.AddAdapter(this);
     }
     Connect();
 }
Exemple #3
0
        /// <summary>
        /// Loads the available <see cref="IBrailleIOAdapter"/> from the adapter extension folder.
        /// </summary>
        /// <param name="manager">The manager.</param>
        /// <param name="iniObjects">The objects sent for initialization.</param>
        /// <returns>List of <see cref="IBrailleIOAdapter"/> from the adapter extension folder.</returns>
        public List <IBrailleIOAdapter> LoadAvailableAdapters(IBrailleIOAdapterManager manager, params object[] iniObjects)
        {
            List <IBrailleIOAdapter> adapters = new List <IBrailleIOAdapter>();

            adapterSupplierExtensions = loadAllAdpaterSuppliers(GetAdapterDirectoryPath());

            if (adapterSupplierExtensions != null && adapterSupplierExtensions.Count > 0)
            {
                foreach (IBrailleIOAdapterSupplier adapterSupplier in adapterSupplierExtensions)
                {
                    if (adapterSupplier != null)
                    {
                        initializeExtensionInterfaces(adapterSupplier, iniObjects);

                        IBrailleIOAdapter adapter = adapterSupplier.GetAdapter(manager);

                        if (adapter != null && !adapters.Contains(adapter))
                        {
                            // add to the list of all available adapters
                            adapters.Add(adapter);

                            initializeExtensionInterfaces(adapter, iniObjects);
                            try
                            {
                                bool initialized = adapterSupplier.InitializeAdapter();
                                if (initialized && manager != null)
                                {
                                    if (adapterSupplier.IsMainAdapter())
                                    {
                                        manager.ActiveAdapter = adapter;
                                    }
                                    else
                                    {
                                        manager.AddAdapter(adapter);
                                    }
                                    InteractionManager.Instance.AddNewDevice(adapter);
                                }
                            }
                            catch (Exception e) {
                                Logger.Instance.Log(LogPriority.DEBUG, "LectorGUI", "[EEROR] can't initialize and register extension adapter:\n" + e);
                            }
                        }
                    }
                }
            }

            mapMonitors(adapters, adapterSupplierExtensions);

            return(adapters);
        }
        /// <summary>
        /// Loads the available <see cref="IBrailleIOAdapter"/> from the adapter extension folder.
        /// </summary>
        /// <param name="manager">The manager.</param>
        /// <param name="iniObjects">The objects sent for initialization.</param>
        /// <returns>List of <see cref="IBrailleIOAdapter"/> from the adapter extension folder.</returns>
        public List<IBrailleIOAdapter> LoadAvailableAdapters(IBrailleIOAdapterManager manager, params object[] iniObjects)
        {
            List<IBrailleIOAdapter> adapters = new List<IBrailleIOAdapter>();

            adapterSupplierExtensions = loadAllAdpaterSuppliers(GetAdapterDirectoryPath());

            if (adapterSupplierExtensions != null && adapterSupplierExtensions.Count > 0)
            {
                foreach (IBrailleIOAdapterSupplier adapterSupplier in adapterSupplierExtensions)
                {
                    if (adapterSupplier != null)
                    {
                        initializeExtensionInterfaces(adapterSupplier, iniObjects);

                        IBrailleIOAdapter adapter = adapterSupplier.GetAdapter(manager);

                        if (adapter != null)
                        {
                            // add to the list of all available adapters
                            adapters.Add(adapter);

                            initializeExtensionInterfaces(adapter, iniObjects);
                            try
                            {
                                bool initialized = adapterSupplier.InitializeAdapter();
                                if (initialized && manager != null)
                                {
                                    if (adapterSupplier.IsMainAdapter())
                                    {
                                        manager.ActiveAdapter = adapter;
                                    }
                                    else
                                    {
                                        manager.AddAdapter(adapter);
                                    }
                                    InteractionManager.Instance.AddNewDevice(adapter);
                                }
                            }
                            catch (Exception e) { Logger.Instance.Log(LogPriority.DEBUG, "LectorGUI", "[EEROR] can't initialize and register extension adapter:\n" + e); }
                        }
                    }
                }
            }

            mapMonitors(adapters, adapterSupplierExtensions);

            return adapters;
        }