void init()
        {
            Monitor = new ShowOff();
            IBrailleIOAdapter showOffAdapter = Monitor.InitializeBrailleIO();

            ActiveAdapter = showOffAdapter;
        }
示例#2
0
        /// <summary>
        /// Sets up a virtual hardware device.
        /// This debug implementation for a real hardware device should enable you to
        /// develop and debug your application without the need of a real hardware device.
        /// It emulates a BrailleDis 7200 device from the Metec AG
        /// </summary>
        /// <param name="title">The title of the device form.</param>
        /// <returns>The instantiated Monitor (can be used for further debug output)</returns>
        IBrailleIOShowOffMonitor loadShowOffAdapter(string title)
        {
            IBrailleIOShowOffMonitor monitor = null;

            if (io != null)
            {
                // create a debug adapter instance (form etc. )
                monitor = new ShowOff();
                ((ShowOff)monitor).SetTitle(title);

                // get the "faked" hardware implementation of this debug monitor
                var showOffAdapter = monitor.GetAdapter(io.AdapterManager);
                // set flag, that this adapter should "mirror" all outputs to the active adapter as well.
                showOffAdapter.Synch = true;

                if (io.AdapterManager != null)
                {
                    // add this debug adapter to the current available AdapterManager to make it available to the BrailleIO users
                    io.AdapterManager.AddAdapter(showOffAdapter);
                    // set it as the main adapter for input and output if no other is available yet
                    if (io.AdapterManager.ActiveAdapter == null)
                    {
                        io.AdapterManager.ActiveAdapter = showOffAdapter;
                    }
                }
            }

            return(monitor);
        }
 /// <summary>
 /// Class for displaying readable text for BrailleTexts in the debug monitor
 /// </summary>
 /// <param name="monitor"></param>
 public DebugMonitorTextRenderer(IBrailleIOShowOffMonitor monitor, BrailleIOMediator io)
 {
     this.monitor = monitor;
     this.io = io;
     preparePen();
     startRenderingThread();
 }
 /// <summary>
 /// Class for displaying readable text for BrailleTexts in the debug monitor
 /// </summary>
 /// <param name="monitor"></param>
 public DebugMonitorTextRenderer(IBrailleIOShowOffMonitor monitor, BrailleIOMediator io)
 {
     this.monitor = monitor;
     this.io = io;
     preparePen();
     startRenderingThread();
 }
示例#5
0
 /// <summary>
 /// Initializes a debug monitor and registers to its events.
 /// </summary>
 private void initDebugGui()
 {
     monitor = loadShowOffAdapter(ll.GetTrans("some.key.title") + " Monitor");
     if (monitor != null)
     {
         // listen to device events
         monitor.Disposed += monitor_Disposed;
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ShowOffAdapterSupplier"/> class.
 /// </summary>
 public ShowOffAdapterSupplier()
 {
     try
     {
         monitor = new ShowOff();
         ((ShowOff)monitor).SetTitle("Tangram Lektor - Monitor");
         monitor.Disposed += new EventHandler(monitor_Disposed);
     }
     catch (Exception ex)
     {
         Logger.Instance.Log(LogPriority.IMPORTANT, this, "[FATAL ERROR] Cant create instance of ShowOff:\n" + ex);
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ShowOffAdapterSupplier"/> class.
 /// </summary>
 public ShowOffAdapterSupplier()
 {
     try
     {
         monitor = new ShowOff();
         ((ShowOff)monitor).SetTitle("Tangram Lektor - Monitor");
         monitor.Disposed += new EventHandler(monitor_Disposed);
         //((ShowOff)monitor).ShowScreenshotMenu();
     }
     catch (Exception ex)
     {
         Logger.Instance.Log(LogPriority.IMPORTANT, this, "[FATAL ERROR] Cant create instance of ShowOff:\n" + ex);
     }
 }
        private void getShowOff()
        {
            if (IO != null)
            {
                // if the current Adapter manager holds an debug dapter, use it
                if (IO.AdapterManager is ShowOffBrailleIOAdapterManager)
                {
                    Monitor = ((ShowOffBrailleIOAdapterManager)IO.AdapterManager).Monitor;
                    foreach (var adapter in IO.AdapterManager.GetAdapters())
                    {
                        if (adapter is BrailleIOAdapter_ShowOff)
                        {
                            showOffAdapter = adapter as AbstractBrailleIOAdapterBase;
                            break;
                        }
                    }
                }

                // if no debug device currently exists, create a new one
                if (showOffAdapter == null)
                {
                    Monitor        = new ShowOff();
                    showOffAdapter = Monitor.GetAdapter(IO.AdapterManager);
                    if (showOffAdapter != null)
                    {
                        IO.AdapterManager.AddAdapter(showOffAdapter);
                    }
                }

                // if a debug adapter could been created, register to its events
                if (showOffAdapter != null)
                {
                    showOffAdapter.Synch = true; // activate that this device receives the pin matrix of the active device, too.

                    #region events

                    showOffAdapter.touchValuesChanged += new EventHandler <BrailleIO_TouchValuesChanged_EventArgs>(_bda_touchValuesChanged);
                    showOffAdapter.keyStateChanged    += new EventHandler <BrailleIO_KeyStateChanged_EventArgs>(_bda_keyStateChanged);

                    #endregion
                }

                if (Monitor != null)
                {
                    Monitor.Disposed += new EventHandler(monitor_Disposed);
                }
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="MockDriver"/> class. This is a simple wrapper for the software adapter itself connected to this GUI.
 /// </summary>
 /// <param name="gui">The GUI.</param>
 public MockDriver(ShowOff gui)
 {
     Monitor = gui;
 }