Example #1
0
        private static void MaxChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            Velocimetre v              = (Velocimetre)d;
            int         numeroTicks    = 10;
            double      deltaVelocitat = v.Max / (double)numeroTicks;
            double      vel            = 0;

            for (int i = 0; i <= numeroTicks; i++, vel += deltaVelocitat)
            {
                v.cnvPrincipal.Children.Add(v.crearTick((int)vel));
            }
        }
Example #2
0
        private static void VelocitatChangedCallback(DependencyObject d,
                                                     DependencyPropertyChangedEventArgs e)
        {
            Velocimetre v = (Velocimetre)d;

            if (v.Velocitat > v.Max)
            {
                v.Velocitat = v.Max;
            }
            else if (v.Velocitat < 0)
            {
                v.Velocitat = 0;
            }
            if (v.Max > 0)
            {
                double angle = v.getAnglePerVelocitat(v.Velocitat);
                ((RotateTransform)v.cnvAgulla.RenderTransform).Angle = angle;
            }
        }