예제 #1
0
        private int GetDateComponentValueFromLogicalIndexBasedOnStepBehavior(StepBehavior behavior, int logicalIndex)
        {
            switch (this.componentType)
            {
            case DateTimeComponentType.Day:
            case DateTimeComponentType.Month:
            case DateTimeComponentType.Year:
                switch (behavior)
                {
                case StepBehavior.Multiples:
                    return((logicalIndex + 1) * this.Step);

                case StepBehavior.BaseAndMultiples:
                    return(logicalIndex == 0 || this.Step == 1 ? logicalIndex + 1 : logicalIndex *this.Step);

                case StepBehavior.StartFromBase:
                    return((logicalIndex * this.Step) + 1);

                default:
                    return(logicalIndex * this.Step);
                }

            case DateTimeComponentType.Minute:
            case DateTimeComponentType.Hour:
            case DateTimeComponentType.AMPM:
                return(logicalIndex * this.Step);
            }

            return(logicalIndex);
        }
예제 #2
0
 private void MoveToNextStep(int stepIndex)
 {
     if (currentStep.nextSteps.Length > stepIndex)
     {
         currentStep = currentStep.nextSteps[stepIndex];
         UpdateCurrentLabel();
     }
 }
예제 #3
0
 void Start()
 {
     currentStep = startStep;
     UpdateCurrentLabel();
     UpdateCurrentLocation(startStep.locationName);
 }
예제 #4
0
        internal int GetStepRemainderForComponent(int componentValue, int minComponentValue, StepBehavior behavior, int step)
        {
            if (step == 1)
            {
                return(0);
            }

            var remainder = 0;

            switch (behavior)
            {
            case StepBehavior.Multiples:
                remainder = componentValue % step;
                break;

            case StepBehavior.StartFromBase:
                remainder = (componentValue - minComponentValue) % step;
                break;

            case StepBehavior.BaseAndMultiples:
                remainder = componentValue == minComponentValue ? 0 : componentValue % step;
                break;
            }

            return(remainder);
        }