Gallifrey.UI.Modern.Models.EditTimerModel.AdjustTime C# (CSharp) Method

AdjustTime() public method

public AdjustTime ( System.TimeSpan timeAdjustmentAmount, bool addTime ) : void
timeAdjustmentAmount System.TimeSpan
addTime bool
return void
        public void AdjustTime(TimeSpan timeAdjustmentAmount, bool addTime)
        {
            var currentTime = new TimeSpan(Hours ?? 0, Minutes ?? 0, 0);

            currentTime = addTime ? currentTime.Add(timeAdjustmentAmount) : currentTime.Subtract(timeAdjustmentAmount);

            if (currentTime.TotalMinutes > 599)
            {
                Hours = 9;
                Minutes = 59;
            }
            else if (currentTime.TotalMinutes < 0)
            {
                Hours = 0;
                Minutes = 0;
            }
            else
            {
                Hours = currentTime.Hours;
                Minutes = currentTime.Minutes;
            }

            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Hours"));
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Minutes"));
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("HasModifiedTime"));
        }