1
0
Fork 0
Browse Source

add current time to dashboard.

This should make it easier for viewers of the app. to see what the current time is -- when viewing it from a distance.
pull/6/head
Craig Oates 3 years ago
parent
commit
5957181250
  1. 8
      src/EyesAndEars.UWP/EyesAndEars.UWP/MainPage.xaml
  2. 7
      src/EyesAndEars.UWP/EyesAndEars.UWP/MainPage.xaml.cs
  3. 19
      src/EyesAndEars.UWP/EyesAndEars.UWP/ViewModels/MainPageVM.cs

8
src/EyesAndEars.UWP/EyesAndEars.UWP/MainPage.xaml

@ -17,7 +17,13 @@
</Grid.RowDefinitions>
<TextBlock x:Name="VersionNumber" Grid.Row="0" Padding="0" Margin="0"
FontSize="12" VerticalAlignment="Top" HorizontalAlignment="Right"/>
FontSize="12" VerticalAlignment="Top"
HorizontalAlignment="Right"/>
<TextBlock x:Name="Time" Grid.Row="0" FontSize="78"
VerticalAlignment="Stretch" HorizontalAlignment="Right"
Text="{x:Bind _vm.CurrentTime, Mode=OneWay, FallbackValue=00:00}"
Margin="0" Padding="0"/>
<StackPanel Grid.Row="0" Orientation="Horizontal"
VerticalAlignment="Top">

7
src/EyesAndEars.UWP/EyesAndEars.UWP/MainPage.xaml.cs

@ -1,7 +1,6 @@
using EyesAndEars.UWP.Services;
using EyesAndEars.UWP.ViewModels;
using System;
using System.Threading;
using Windows.ApplicationModel;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
@ -36,6 +35,7 @@ namespace EyesAndEars.UWP {
_vm.Device4 = DataServices.CreateFallBackDevice(4);
_vm.Device5 = DataServices.CreateFallBackDevice(5);
// _vm.Device6 = DataServices.CreateFallBackDevice(6);
_vm.CurrentTime = DateTime.UtcNow.ToShortTimeString();
DataContext = _vm;
}
@ -52,10 +52,11 @@ namespace EyesAndEars.UWP {
// Devices 3 and 6 are not in use.
_vm.Device1 = await DataServices.UpdateDevice(url, 1);
_vm.Device2 = await DataServices.UpdateDevice(url, 2);
_vm.Device3 = await DataServices.UpdateDevice(url, 3);
// _vm.Device3 = await DataServices.UpdateDevice(url, 3);
_vm.Device4 = await DataServices.UpdateDevice(url, 4);
_vm.Device5 = await DataServices.UpdateDevice(url, 5);
_vm.Device6 = await DataServices.UpdateDevice(url, 6);
// _vm.Device6 = await DataServices.UpdateDevice(url, 6);
_vm.CurrentTime = DateTime.UtcNow.ToShortTimeString();
}
else {
IntialiseDataContext();

19
src/EyesAndEars.UWP/EyesAndEars.UWP/ViewModels/MainPageVM.cs

@ -1,4 +1,5 @@
using EyesAndEars.UWP.Models;
using System;
using System.ComponentModel;
namespace EyesAndEars.UWP.ViewModels {
@ -19,13 +20,25 @@ namespace EyesAndEars.UWP.ViewModels {
public MainPageVM(Device f1, Device f2, Device f3,
Device g1, Device g2, Device g3) {
Device1 = f1;
Device2 = f2;
Device3 = f3; // Not in use.
Device3 = f3;
Device4 = g1;
Device5 = g2;
Device6 = g3; // Not in use.
Device6 = g3;
CurrentTime = DateTime.Now.ToShortTimeString();
}
string _currentTime;
public string CurrentTime {
get { return _currentTime; }
set {
if (value != _currentTime) {
_currentTime = value;
NotifyPropertyChanged("CurrentTime");
}
}
}
string _baseURL;