void moveVertical(string viewName, string viewRangeName, int steps) { if (IO == null && IO.GetView(viewName) as BrailleIOScreen != null) { return; } BrailleIOViewRange vr = ((BrailleIOScreen)IO.GetView(viewName)).GetViewRange(viewRangeName); if (vr != null) { vr.MoveVertical(steps); } IO.RenderDisplay(); }
/// <summary> /// Moves the content of the view in vertical direction. /// </summary> /// <param name="vr">The view to move the content of.</param> /// <param name="pins">The pins to move in vertical direction. Negative values will move the content to the right; positive values to the left.</param> /// <param name="render">if set to <c>true</c> a new rendering is forced.</param> /// <returns> /// <c>true</c> if the content was moved successfully. /// </returns> /// <remarks> /// Views will change their presentation only after calling <see cref="BrailleIOMediator.Instance.RenderDisplay()" />. /// Call the <c>RenderDisplay()</c> function after you have done all your changes to see the results. /// </remarks> public static bool MoveVertical(BrailleIOViewRange vr, int pins, bool render = false) { if (vr != null) { int oldO = vr.GetYOffset(); vr.MoveVertical(pins); if (render && BrailleIOMediator.Instance != null) { BrailleIOMediator.Instance.RenderDisplay(); } return(oldO != vr.GetYOffset()); } return(false); }
/// <summary> /// Move the content of the given view range in vertical direction. /// </summary> /// <param name="viewName">name of the view</param> /// <param name="viewRangeName">name of the view range</param> /// <param name="steps">count of pins to move</param> protected bool moveVertical(string viewName, string viewRangeName, int steps) { if (io == null && io.GetView(viewName) as BrailleIOScreen != null) { return(false); } BrailleIOViewRange vr = ((BrailleIOScreen)io.GetView(viewName)).GetViewRange(viewRangeName); if (GetVisibleScreen().Name.Equals(BS_MINIMAP_NAME)) { vr = screenBeforeMinimap.GetViewRange(viewRangeName); // offset has to be the offset of mainscreen view range instead of minimap view range, because minimap offset is always 0/0 } if (vr != null) { if ((steps > 0 && vr.GetYOffset() >= 0) || (new Point(vr.GetXOffset(), vr.GetYOffset()).Equals(vr.MoveVertical(steps)))) { audioRenderer.PlayWaveImmediately(StandardSounds.End); return(false); } } io.RefreshDisplay(true); return(true); }