diff --git a/src/CTime2/Views/Terminal/TerminalView.xaml b/src/CTime2/Views/Terminal/TerminalView.xaml index 34de277..67b8048 100644 --- a/src/CTime2/Views/Terminal/TerminalView.xaml +++ b/src/CTime2/Views/Terminal/TerminalView.xaml @@ -6,17 +6,70 @@ xmlns:interactivity="using:Microsoft.Xaml.Interactivity" xmlns:behaviors="using:UwCore.Behaviors" xmlns:core="using:Microsoft.Xaml.Interactions.Core" + xmlns:converter="using:UwCore.Converter" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - mc:Ignorable="d"> + mc:Ignorable="d" + > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IsHitTestVisible="False" + Grid.Row="0"> diff --git a/src/CTime2/Views/Terminal/TerminalViewModel.cs b/src/CTime2/Views/Terminal/TerminalViewModel.cs index c61be73..60912cb 100644 --- a/src/CTime2/Views/Terminal/TerminalViewModel.cs +++ b/src/CTime2/Views/Terminal/TerminalViewModel.cs @@ -1,7 +1,9 @@ using System; using System.Diagnostics; using System.Reactive; +using System.Threading; using System.Threading.Tasks; +using Caliburn.Micro; using Caliburn.Micro.ReactiveUI; using CTime2.Core.Data; using CTime2.Core.Services.ApplicationState; @@ -18,8 +20,17 @@ public class TerminalViewModel : ReactiveScreen private readonly ICTimeService _cTimeService; private readonly IApplicationStateService _applicationStateService; + private readonly Timer _timer; + + private TimeSpan _currentTime; private string _rfidKey; + public TimeSpan CurrentTime + { + get { return this._currentTime; } + set { this.RaiseAndSetIfChanged(ref this._currentTime, value); } + } + public string RfidKey { get { return this._rfidKey; } @@ -40,12 +51,22 @@ public TerminalViewModel(ICTimeService cTimeService, IApplicationStateService ap this.Stamp = UwCoreCommand.Create(canStamp, this.StampImpl) .HandleExceptions() .ShowLoadingOverlay("Stempeln..."); + + this._timer = new Timer(this.Tick, null, TimeSpan.Zero, TimeSpan.FromMilliseconds(100)); + + this.DisplayName = "Terminal"; + } + + private void Tick(object state) + { + Execute.OnUIThread(() => + { + this.CurrentTime = DateTimeOffset.Now.TimeOfDay; + }); } private async Task StampImpl() { - Debug.WriteLine(this.RfidKey); - await this._cTimeService.SaveTimer( string.Empty, this.RfidKey,