Exemple #1
0
        public void ZoomByUnit(ZoomUnit zoomUnit)
        {
            double delta = 0;

            switch (zoomUnit)
            {
            case ZoomUnit.LargeDecrement: delta = -0.25; break;

            case ZoomUnit.SmallDecrement: delta = -0.1; break;

            case ZoomUnit.LargeIncrement: delta = 0.25; break;

            case ZoomUnit.SmallIncrement: delta = 0.1; break;

            case ZoomUnit.NoAmount: delta = 0; break;
            }
            double proposed = this.zoomLevel + delta;

            if (proposed < 0.25 || proposed > 4.0)
            {
                throw new InvalidOperationException();
            }
            this.zoomLevel = proposed;
        }
 public void ZoomByUnit(ZoomUnit zoomUnit)
 {
     double delta = 0;
     switch (zoomUnit)
     {
         case ZoomUnit.LargeDecrement: delta = -0.25; break;
         case ZoomUnit.SmallDecrement: delta = -0.1; break;
         case ZoomUnit.LargeIncrement: delta = 0.25; break;
         case ZoomUnit.SmallIncrement: delta = 0.1; break;
         case ZoomUnit.NoAmount: delta = 0; break;
     }
     double proposed = this.zoomLevel + delta;
     if (proposed < 0.25 || proposed > 4.0)
     {
         throw new InvalidOperationException();
     }
     this.zoomLevel = proposed;
 }