/
OdometerTripTimeDisplayProcessor.cs
65 lines (52 loc) · 1.56 KB
/
OdometerTripTimeDisplayProcessor.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
using System;
using GHIElectronics.NETMF.FEZ;
using GHIElectronics.NETMF.Hardware;
using Grommet.Ext;
using NetMf.CommonExtensions;
namespace BikeComputer
{
class OdometerTripTimeDisplayProcessor : IDisplayProcessor
{
private BikeData bikeData = null;
public OdometerTripTimeDisplayProcessor(BikeData inBikeData)
{
bikeData = inBikeData;
}
public void Display()
{
String odometerText = StringUtility.Format("{0:F3} km", bikeData.OdoDone);
String timerText = String.Empty;
if (bikeData.IsStartTripSet)
{
TimeSpan tripSpan = DateTime.Now - bikeData.StartTrip;
timerText = StringUtility.Format("{0:T}", tripSpan);
}
else
{
timerText = "00:00:00";
}
// Odometer
FEZ_Shields.KeypadLCD.SetCursor(1, 0);
FEZ_Shields.KeypadLCD.Print(odometerText);
// Timer
FEZ_Shields.KeypadLCD.SetCursor(1, 11);
FEZ_Shields.KeypadLCD.Print(timerText.Substring(0, 5));
}
public bool IsProcessingKey()
{
return false;
}
public void ProcessKey(FEZ_Shields.KeypadLCD.Keys keyPressed)
{
return;
}
public void BeginEdit()
{
return;
}
public bool CanEditLine()
{
return false;
}
}
}