public SmallTimeInterval(SmallTime start, SmallTime end) { Assert.IsTrue(start.Value <= end.Value); Start = start; End = end; }
protected override void OnTilePropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == "IsAlarmDisabled") { var tile = sender as AlarmTileViewModel; if (tile.IsAlarmDisabled) { if (_timers.Keys.Contains(tile)) { _timers[tile].Dispose(); _timers.Remove(tile); } } else { var now = new SmallTime(DateTime.Now.Hour, DateTime.Now.Minute); var interval = ((SmallTime)tile.Data).Milliseconds - now.Milliseconds; if (interval < 0) { return; } if (_timers.Keys.Contains(tile)) { _timers[tile].Change(interval, Timeout.Infinite); } else { _timers.Add(tile, new Timer(TimerCallback)); _timers[tile].Change(interval, Timeout.Infinite); } } } }
public void PastCapabilityBasicTest(int hr, int min, string expected) { b.Info.Flow(); var st = new SmallTime() { Hour = hr, Minute = min }; var sut = ConverterChainBase.GetChain(new PastAndToCapability(), new DefaultNumbersToWords()); var res = sut.Handle(new SmallTimeRenderer(st)); Assert.Contains(expected, res.Render()); }
public void DefaultWords_BasicTest(int hr, int min, string expMin, string expHour) { b.Info.Flow(); var st = new SmallTime() { Hour = hr, Minute = min }; var sut = new DefaultNumbersToWords(); var res = sut.Handle(new SmallTimeRenderer(st)); string rend = res.Render(); Assert.Contains(expMin, rend); Assert.Contains(expHour, rend); }
protected override void ProvideTileWithValue(AlarmTileViewModel tile) { var now = new SmallTime(DateTime.Now.Hour, DateTime.Now.Minute); var time = ((SmallTime)tile.Data).Milliseconds - now.Milliseconds; if (time >= 0) { if (_timers.Keys.Contains(tile)) { _timers[tile].Change(time, Timeout.Infinite); } else { _timers.Add(tile, new Timer(TimerCallback)); _timers[tile].Change(time, Timeout.Infinite); } } tile.Text = tile.Data.ToString(); }
public AlarmTileViewModel() { Type = Enums.TileType.Alarm; Data = new SmallTime(); }