public ParkRateViewModel(ParkRateConfig config) { _config = config; var now = DateTime.Now; PropertyChanged += (sender, args) => { UpdateFields(args); }; _arrivalTimeColor = HelpColor; _leaveTimeColor = HelpColor; _dateTimeParser = new DateTimeParser(); _paySlackTime = config.PaySlackTime; _payInAdvance = config.PayInAdvance; _payEveryMinutes = config.PayEveryMinutes; _payAmountPerHour = StringToDecimal(config.PayAmountPerHour, _payAmountPerHour); _payAmountPerHourStr = config.PayAmountPerHour; _slackTime = config.SlackTime; LeaveTimeStr = now.ToString(DateTimeParser.TimeFormat); LeaveDateStr = now.ToString(DateTimeParser.DateFormat); ArrivalTimeStr = ComputeArrivalTime(now); ArrivalDateStr = _leaveDateStr; ComputeExamples(); }
public void UpdateWithConfig(ParkRateConfig config) { PaySlackTime = config.PaySlackTime; PayInAdvance = config.PayInAdvance; PayEveryMinutes = config.PayEveryMinutes; PayAmountPerHourStr = config.PayAmountPerHour; SlackTime = config.SlackTime; ArrivalTimeStr = string.Empty; }