Exemple #1
0
        /// <summary>
        /// StylusPointProperty
        /// </summary>
        /// <param name="stylusPointProperty"></param>
        /// <param name="minimum">minimum</param>
        /// <param name="maximum">maximum</param>
        /// <param name="unit">unit</param>
        /// <param name="resolution">resolution</param>
        public StylusPointPropertyInfo(StylusPointProperty stylusPointProperty, int minimum, int maximum, StylusPointPropertyUnit unit, float resolution)
            : base(stylusPointProperty) //base checks for null
        {
            // validate unit
            if (!StylusPointPropertyUnitHelper.IsDefined(unit))
            {
                throw new InvalidEnumArgumentException("unit", (int)unit, typeof(StylusPointPropertyUnit));
            }

            // validate min/max
            if (maximum < minimum)
            {
                throw new ArgumentException(SR.Get(SRID.Stylus_InvalidMax), "maximum");
            }

            // validate resolution
            if (resolution < 0.0f)
            {
                throw new ArgumentException(SR.Get(SRID.InvalidStylusPointPropertyInfoResolution), "resolution");
            }

            _min        = minimum;
            _max        = maximum;
            _resolution = resolution;
            _unit       = unit;
        }
        /// <summary>
        /// StylusPointProperty
        /// </summary>
        /// <param name="stylusPointProperty"></param>
        /// <param name="minimum">minimum</param>
        /// <param name="maximum">maximum</param>
        /// <param name="unit">unit</param>
        /// <param name="resolution">resolution</param>
        public StylusPointPropertyInfo(StylusPointProperty stylusPointProperty, int minimum, int maximum, StylusPointPropertyUnit unit, float resolution)
            : base(stylusPointProperty) //base checks for null
        {
            // validate unit
            if (!StylusPointPropertyUnitHelper.IsDefined(unit))
            {
                throw new InvalidEnumArgumentException("unit", (int)unit, typeof(StylusPointPropertyUnit));
            }

            // validate min/max
            if (maximum < minimum)
            {
                throw new ArgumentException(SR.Get(SRID.Stylus_InvalidMax), "maximum");
            }

            // validate resolution
            if (resolution < 0.0f)
            {
                throw new ArgumentException(SR.Get(SRID.InvalidStylusPointPropertyInfoResolution), "resolution");
            }

            _min = minimum;
            _max = maximum;
            _resolution = resolution;
            _unit = unit;
        }
 internal static bool IsDefined(StylusPointPropertyUnit unit)
 {
     if (unit >= StylusPointPropertyUnit.None && unit <= StylusPointPropertyUnit.Grams)
     {
         return true;
     }
     return false;
 }
 internal static bool IsDefined(StylusPointPropertyUnit unit)
 {
     if (unit >= StylusPointPropertyUnit.None && unit <= StylusPointPropertyUnit.Grams)
     {
         return(true);
     }
     return(false);
 }
        /// <summary>
        /// Convert WM_POINTER units to WPF units
        /// </summary>
        /// <param name="pointerUnit"></param>
        /// <returns></returns>
        internal static StylusPointPropertyUnit?FromPointerUnit(uint pointerUnit)
        {
            StylusPointPropertyUnit unit = StylusPointPropertyUnit.None;

            _pointerUnitMap.TryGetValue(pointerUnit & UNIT_MASK, out unit);

            return((IsDefined(unit)) ? unit : (StylusPointPropertyUnit?)null);
        }
 /// <summary>
 /// For a given StylusPointProperty, instantiates a StylusPointPropertyInfo with default values
 /// </summary>
 /// <param name="stylusPointProperty"></param>
 public StylusPointPropertyInfo(StylusPointProperty stylusPointProperty) 
     : base (stylusPointProperty) //base checks for null
 {
     StylusPointPropertyInfo info =
         StylusPointPropertyInfoDefaults.GetStylusPointPropertyInfoDefault(stylusPointProperty);
     _min = info.Minimum;
     _max = info.Maximum;
     _resolution = info.Resolution;
     _unit = info.Unit;
     
 }
Exemple #7
0
        /// <summary>
        /// For a given StylusPointProperty, instantiates a StylusPointPropertyInfo with default values
        /// </summary>
        /// <param name="stylusPointProperty"></param>
        public StylusPointPropertyInfo(StylusPointProperty stylusPointProperty)
            : base(stylusPointProperty)  //base checks for null
        {
            StylusPointPropertyInfo info =
                StylusPointPropertyInfoDefaults.GetStylusPointPropertyInfoDefault(stylusPointProperty);

            _min        = info.Minimum;
            _max        = info.Maximum;
            _resolution = info.Resolution;
            _unit       = info.Unit;
        }
        /// <summary>
        /// Create a StylusPointPropertyInfo.
        /// </summary>
        /// <param name="random"></param>
        /// <returns></returns>
        public override StylusPointPropertyInfo Create(DeterministicRandom random)
        {
            StylusPointProperty stylusPointProperty = random.NextStaticField <StylusPointProperty>(typeof(StylusPointProperties));
            int minimum = random.Next(10000);
            int maximum = random.Next(10000) + minimum;
            StylusPointPropertyUnit unit = random.NextEnum <StylusPointPropertyUnit>();
            float resolution             = random.Next(100) / 10f;

            StylusPointPropertyInfo stylusPointPropertyInfo = new StylusPointPropertyInfo(stylusPointProperty, minimum, maximum, unit, resolution);

            return(stylusPointPropertyInfo);
        }
 public StylusPointPropertyInfo(StylusPointProperty stylusPointProperty, int minimum, int maximum, StylusPointPropertyUnit unit, float resolution) : base (default(StylusPointProperty))
 {
 }
Exemple #10
0
 public StylusPointPropertyInfo(StylusPointProperty stylusPointProperty, int minimum, int maximum, StylusPointPropertyUnit unit, float resolution) : base(default(StylusPointProperty))
 {
 }
Exemple #11
0
 //
 // Summary:
 //     Initializes a new instance of the System.Windows.Input.StylusPointPropertyInfo
 //     class using the specified values.
 //
 // Parameters:
 //   stylusPointProperty:
 //     The System.Windows.Input.StylusPointProperty to base the new System.Windows.Input.StylusPointProperty
 //     on.
 //
 //   minimum:
 //     The minimum value accepted for the System.Windows.Input.StylusPoint property.
 //
 //   maximum:
 //     The maximum value accepted for the System.Windows.Input.StylusPoint property.
 //
 //   unit:
 //
 //   resolution:
 //     The scale that converts a System.Windows.Input.StylusPoint property value
 //     into its units.
 public StylusPointPropertyInfo(StylusPointProperty stylusPointProperty, int minimum, int maximum, StylusPointPropertyUnit unit, float resolution)
     : base(stylusPointProperty)
 {
     throw new NotImplementedException();
 }