Skip to content
Permalink
Browse files

added additional key handling to fix bug caused by enabling IsDefault…

…, which also enables other keys.
  • Loading branch information...
Mike Pohatu
Mike Pohatu committed Jun 25, 2019
1 parent 4e98087 commit a67ab1de003e510051cd411c9968f60e5ef0647a
Showing with 27 additions and 6 deletions.
  1. +27 −6 TsGui/View/Layout/TsPage.cs
@@ -19,7 +19,8 @@
using System.Xml.Linq;
using System.Windows;
using System.Windows.Threading;

using System.Windows.Input
;
using TsGui.Events;
using TsGui.Grouping;
using TsGui.View.GuiOptions;
@@ -120,6 +121,7 @@ public TsPage(XElement SourceXml, PageDefaults Defaults, IDirector MainControlle
this.GroupingStateChange += this.OnPageHide;
this._pageui.DataContext = this;
this._pageui.ButtonGrid.DataContext = Defaults.Buttons;
this._pageui.KeyDown += this.OnKeyDown;

this.LoadXml(SourceXml);
this.Update();
@@ -164,16 +166,19 @@ public void Cancel()

public void MovePrevious()
{
foreach (IValidationGuiOption option in this._table.ValidationOptions)
{ option.ClearToolTips(); }
if ( this._previouspage != null)
{
foreach (IValidationGuiOption option in this._table.ValidationOptions)
{ option.ClearToolTips(); }

this.ReleaseThisPage();
this._controller.MovePrevious();
this.ReleaseThisPage();
this._controller.MovePrevious();
}
}

public void MoveNext()
{
if (this.OptionsValid() == true)
if (this._nextpage != null && this.OptionsValid() == true)
{
this.ReleaseThisPage();
this._controller.MoveNext();
@@ -232,5 +237,21 @@ private void ConnectPrevPage(TsPage NewPrevPage)
{
this._previouspage = NewPrevPage;
}

public void OnKeyDown(object sender, KeyEventArgs e)
{
if (Keyboard.IsKeyDown(Key.LeftAlt) || Keyboard.IsKeyDown(Key.RightAlt))
{
if (e.SystemKey == Key.Right)
{
this.MoveNext();
}
else if (e.SystemKey == Key.Left)
{
this.MovePrevious();
}
e.Handled = true;
}
}
}
}

0 comments on commit a67ab1d

Please sign in to comment.
You can’t perform that action at this time.