Beispiel #1
0
        void CalNext(ref int minute, ref int hour, ref int day, ref int month, ref int year)
        {
            #region ***分***
            if (Minutes != null && Minutes.MoveNext())//按分钟循环
            {
                minute = Minutes.Current;
                return;
            }

            //重置
            if (Minutes != null)
            {
                Minutes.Reset();
                minute = Minutes.Current;
            }
            else
            {
                minute = 0;
            }
            #endregion

            #region ***时***
            if (Hours == null && hour < 23)//每小时循环
            {
                hour++;
                return;
            }
            else if (Hours != null && Hours.MoveNext())
            {
                hour = Hours.Current;
                return;
            }
            //重置
            if (Hours != null)
            {
                Hours.Reset();
                hour = Hours.Current;
            }
            else
            {
                hour = 0;
            }
            #endregion

            #region ***日***
            if (Days == null)
            {
                if (_isFirst)
                {
                    _isFirst = false;
                    return;
                }
                var newD = InvokeTime.AddDays(1);
                day   = newD.Day;
                month = newD.Month;
                year  = newD.Year;
                return;
            }
            else if (Days.MoveNext())
            {
                day = Days.Current;
                return;
            }
            else
            {
                Days.Reset();
                day = Days.Current;
            }

            if (Months == null)
            {
                if (_isMonthFirst)
                {
                    _isMonthFirst = false;
                    return;
                }
                var newD = InvokeTime.AddMonths(1);
                month = newD.Month;
                year  = newD.Year;
                return;
            }
            #endregion
        }