/// <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(); }
public BrailleIOExample() { io = BrailleIOMediator.Instance; io.AdapterManager = new ShowOffBrailleIOAdapterManager(); Monitor = ((ShowOffBrailleIOAdapterManager)io.AdapterManager).Monitor; showOff = io.AdapterManager.ActiveAdapter as AbstractBrailleIOAdapterBase; registerToEvents(); showExample(); }
bool IInitialObjectReceiver.InitializeObjects(params object[] objs) { bool success = true; if (objs != null && objs.Length > 0) { unregisterToEvents(); foreach (var item in objs) { try { if (item != null) { if (item is IDisposable) { shutDowner.Add(item as IDisposable); } if (item is AudioRenderer) { audioRenderer = item as AudioRenderer; } else if (item is InteractionManager) { interactionManager = item as InteractionManager; } else if (item.GetType().FullName.Equals("BrailleIO.BrailleIOMediator")) // is BrailleIO.BrailleIOMediator) { io = item as BrailleIO.BrailleIOMediator; if (io == null) { throw new NullReferenceException( @"The referenced Type 'BrailleIO.BrailleIOMediator' seems to be the same but a type conversion wasn't possible. This can be caused by adding the type defining reference (dll) twice to the project. Build the extension without local copies of overhanded types."); } DebugMonitorTextRenderer dbmtr = new DebugMonitorTextRenderer(monitor, io); } } } catch { success = false; } } registerToEvents(); } return(success); }
private void initRendererHook() { WindowManager wm = WindowManager.Instance; if (wm != null) { BrailleIOMediator io = BrailleIOMediator.Instance; if (io != null) { var fsScreen = io.GetView(WindowManager.BS_FULLSCREEN_NAME); var nsScreen = io.GetView(WindowManager.BS_MAIN_NAME); addRendererHookToScreen(fsScreen as BrailleIOScreen); addRendererHookToScreen(nsScreen as BrailleIOScreen); } } }
/// <summary> /// Initializes the BrailleIO framework. /// Sets up a connection Thread for a BrailleDis device. /// Sets up a ShowOff-Adapter as debug output and input simulation. /// Add the devices to the InteractionManager so it can register to the input events. /// Register for Button events from the interaction manager to show them as debug output /// on the ShowOff adapter. /// </summary> private void initializeBrailleIO() { io = BrailleIOMediator.Instance; //Task t = new Task(new Action(() => //{ if (io != null) { List <IBrailleIOAdapter> adapters = LoadAvailableAdapters(io.AdapterManager, this.windowManager, this.interactionManager, this.audioRenderer, this.OpenOffice, this.io ); } //})); //t.Start(); }
private bool[,] RenderTextBoxTextView(IViewBoxModel view, UiElement textBoxContent) { MatrixBrailleRenderer m = new MatrixBrailleRenderer(); BrailleIOViewRange tmpTextBoxView; BrailleIOMediator brailleIOMediator = BrailleIOMediator.Instance; BrailleIOScreen screen = brailleIOMediator.GetView(textBoxContent.screenName) as BrailleIOScreen; if (screen.GetViewRange("_TextBoxText_" + textBoxContent.viewName) as BrailleIOViewRange != null) { tmpTextBoxView = screen.GetViewRange("_TextBoxText_" + textBoxContent.viewName) as BrailleIOViewRange; } else { tmpTextBoxView = new BrailleIOViewRange(view.ViewBox.Left + 3, view.ViewBox.Top + 2, view.ViewBox.Width - 5, view.ViewBox.Height - 4); tmpTextBoxView.Name = "_TextBoxText_" + textBoxContent.viewName; tmpTextBoxView.SetText(textBoxContent.text); tmpTextBoxView.ShowScrollbars = textBoxContent.isScrollbarShow; } tmpTextBoxView.SetZIndex(3); bool[,] textMatrix; if (tmpTextBoxView.ContentBox.Height <= 0 || tmpTextBoxView.ContentBox.Width <= 0) { textMatrix = new bool[0, 0]; } else { textMatrix = m.RenderMatrix(tmpTextBoxView, (textBoxContent.text as object == null ? "" : textBoxContent.text as object)); } if (screen != null) { BrailleIOViewRange viewRange = screen.GetViewRange(tmpTextBoxView.Name); if (viewRange == null) { ((BrailleIOScreen)brailleIOMediator.GetView(textBoxContent.screenName)).AddViewRange(tmpTextBoxView.Name, tmpTextBoxView); viewRange = screen.GetViewRange(tmpTextBoxView.Name); } viewRange.SetText(textBoxContent.text); } return(textMatrix); }
private bool[,] RenderTextBox(IViewBoxModel view, UiElement textBoxContent) { bool[,] viewMatrix; if (textBoxContent.isDisabled) { viewMatrix = Helper.createBoxDeaktivatedUpDown(view.ViewBox.Height, view.ViewBox.Width); } else { viewMatrix = Helper.createBox(view.ViewBox.Height, view.ViewBox.Width); //erstmal eine eckige Matrix } //Ecke links oben abrunden Debug.Print(viewMatrix.GetLength(0).ToString()); Debug.Print(viewMatrix.GetLength(1).ToString()); if (viewMatrix.GetLength(0) <= 0 || viewMatrix.GetLength(1) <= 0) { return(new bool[0, 0]); } viewMatrix[0, 0] = false; if (viewMatrix.GetLength(1) > 1) { viewMatrix[1, 0] = false; } if (viewMatrix.GetLength(0) > 1) { viewMatrix[0, 1] = false; } if (viewMatrix.GetLength(0) > 1 && viewMatrix.GetLength(1) > 1) { viewMatrix[1, 1] = true; } BrailleIOViewRange tmpBoxView = new BrailleIOViewRange(view.ViewBox.Left, view.ViewBox.Top, view.ViewBox.Width, view.ViewBox.Height); tmpBoxView.Name = "_B_" + textBoxContent.screenName + view.ViewBox.Left + view.ViewBox.Top + view.ViewBox.Width + view.ViewBox.Height; // tmpBoxView.SetText(textBoxText); tmpBoxView.SetMatrix(viewMatrix); // tmpBoxView.ShowScrollbars = true; tmpBoxView.SetYOffset(0); tmpBoxView.SetZIndex(2); object cM = textBoxContent.text as object; IViewBoxModel tmpModel = tmpBoxView as IViewBoxModel; callAllPreHooks(ref tmpModel, ref cM); tmpBoxView = tmpBoxView as BrailleIOViewRange; BrailleIOMediator brailleIOMediator = BrailleIOMediator.Instance; BrailleIOScreen screen = (BrailleIOScreen)brailleIOMediator.GetView(textBoxContent.screenName); if (screen != null) { BrailleIOViewRange viewRange = screen.GetViewRange(tmpBoxView.Name); if (viewRange == null) { ((BrailleIOScreen)brailleIOMediator.GetView(textBoxContent.screenName)).AddViewRange(tmpBoxView.Name, tmpBoxView); } } callAllPostHooks(tmpBoxView, cM, ref viewMatrix, false); return(viewMatrix); }
bool IInitialObjectReceiver.InitializeObjects(params object[] objs) { bool success = true; if (objs != null && objs.Length > 0) { unregisterToEvents(); foreach (var item in objs) { try { if (item != null) { if (item is IDisposable) { shutDowner.Add(item as IDisposable); } if (item is AudioRenderer) { audioRenderer = item as AudioRenderer; } else if (item is InteractionManager) { interactionManager = item as InteractionManager; } else if (item.GetType().FullName.Equals("BrailleIO.BrailleIOMediator")) // is BrailleIO.BrailleIOMediator) { io = item as BrailleIO.BrailleIOMediator; if (io == null) { throw new NullReferenceException( @"The referenced Type 'BrailleIO.BrailleIOMediator' seems to be the same but a type conversion wasn't possible. This can be caused by adding the type defining reference (dll) twice to the project. Build the extension without local copies of overhanded types."); } DebugMonitorTextRenderer dbmtr = new DebugMonitorTextRenderer(monitor, io); } } } catch { success = false; } } registerToEvents(); } return success; }
/// <summary> /// Initializes the BrailleIO framework. /// Sets up a connection Thread for a BrailleDis device. /// Sets up a ShowOff-Adapter as debug output and input simulation. /// Add the devices to the InteractionManager so it can register to the input events. /// Register for Button events from the interaction manager to show them as debug output /// on the ShowOff adapter. /// </summary> private void initializeBrailleIO() { io = BrailleIOMediator.Instance; if (io != null) { List<IBrailleIOAdapter> adapters = LoadAvailableAdapters(io.AdapterManager, this.windowManager, this.interactionManager, this.audioRenderer, this.OpenOffice, this.io ); } }