示例#1
0
 public void InflateBySeconds(double value)
 {
     if (value > 0.0d)
     {
         /*
          * steps is positive
          * decrease min, increase max by the amount of steps
          */
         if (Minimum.TryAddSeconds(-value.NotBelow((Bounds.Minimum - Minimum).Seconds()), out DateTime dtn))
         {
             Minimum = dtn;
         }
         if (Maximum.TryAddSeconds(value.NotAbove((Bounds.Maximum - Maximum).Seconds()), out DateTime dtx))
         {
             Maximum = dtx;
         }
     }
     else if (value < 0.0d)
     {
         /*
          * steps is negative
          * increase min, decrease max by the amount of steps
          */
         if (Minimum.TryAddSeconds(-value.NotAbove((Bounds.Maximum - Minimum).Seconds()), out DateTime dtn))
         {
             Minimum = dtn;
         }
         if (Maximum.TryAddSeconds(value.NotBelow((Bounds.Minimum - Maximum).Seconds()), out DateTime dtx))
         {
             Maximum = dtx;
         }
     }
 }
示例#2
0
 public void ShiftBySeconds(double value)
 {
     if (value > 0.0d)
     {
         /*
          * steps is positive
          * increase min, max by the amount of steps only
          * if they will be less than or equal bounds max
          */
         if (Minimum.TryAddSeconds(value.NotAbove((Bounds.Maximum - Minimum).Seconds()), out DateTime dtn))
         {
             Minimum = dtn;
         }
         if (Maximum.TryAddSeconds(value.NotAbove((Bounds.Maximum - Maximum).Seconds()), out DateTime dtx))
         {
             Maximum = dtx;
         }
     }
     else if (value < 0.0d)
     {
         /*
          * steps is negative
          * decrease min, max by the amount of steps only
          * if they will be greater than or equal bounds min
          */
         // This is not a mistake, I'll actually add a negative to a negative
         if (Minimum.TryAddSeconds(value.NotBelow((Bounds.Minimum - Minimum).Seconds()), out DateTime dtn))
         {
             Minimum = dtn;
         }
         if (Maximum.TryAddSeconds(value.NotBelow((Bounds.Minimum - Maximum).Seconds()), out DateTime dtx))
         {
             Maximum = dtx;
         }
     }
 }