|
|
|
|
@ -1,4 +1,5 @@ |
|
|
|
|
using RobotClientWpf.Utilities; |
|
|
|
|
using RobotLib.Status; |
|
|
|
|
using System.Windows.Controls; |
|
|
|
|
using System.Windows.Input; |
|
|
|
|
|
|
|
|
|
@ -12,7 +13,7 @@ namespace RobotClientWpf.Views |
|
|
|
|
private static readonly NLog.Logger log = NLog.LogManager.GetCurrentClassLogger(); |
|
|
|
|
private ChallengeFactory? challenge; |
|
|
|
|
private MainWindow? mainWindow; |
|
|
|
|
private const int AMOUNT_SPEED_ADDED_PER_CLICK = 200; |
|
|
|
|
private const int AMOUNT_SPEED_ADDED_PER_CLICK = 350; |
|
|
|
|
private const int TURN_ANGLE_PER_CLICK = 30; |
|
|
|
|
|
|
|
|
|
public MainView() |
|
|
|
|
@ -27,6 +28,22 @@ namespace RobotClientWpf.Views |
|
|
|
|
// subscribe to events |
|
|
|
|
this.challenge.RobotStationary.SplitFlap.SplitFlapDisplayChanged += this.SplitFlap_SplitFlapDisplayChanged; |
|
|
|
|
this.challenge.RobotMobile.Battery.BatteryChanged += Battery_BatteryChanged; |
|
|
|
|
this.challenge.RobotMobile.Status.PresentChanged += Status_PresentChanged; |
|
|
|
|
this.challenge.RobotMobile.Status.StatusChanged += Status_StatusChanged; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void Status_StatusChanged(object? sender, RobotLib.Status.StatusEventArgs e) |
|
|
|
|
{ |
|
|
|
|
// if status manual is set => reset present counter |
|
|
|
|
if(e.Status == RoboStatus.Manual || e.Status == RoboStatus.Auto) |
|
|
|
|
{ |
|
|
|
|
UIAccessHelpers.SetTextboxText(tbPresentCount, ""); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void Status_PresentChanged(object? sender, RobotLib.Status.PresentEventArgs e) |
|
|
|
|
{ |
|
|
|
|
UIAccessHelpers.SetTextboxText(tbPresentCount, e.Present.ToString()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void Battery_BatteryChanged(object? sender, RobotLib.Battery.BatteryEventArgs e) |
|
|
|
|
@ -101,10 +118,5 @@ namespace RobotClientWpf.Views |
|
|
|
|
e.Handled = true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void UserControl_KeyDown(object sender, KeyEventArgs e) |
|
|
|
|
{ |
|
|
|
|
this.HandleKeyDownEvent(sender, e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|