Example #1
0
        public BalanceBoardBinding(
            IBalanceBoardInput input,
            Configuration.InputValueHandle handle,
            MovementOrientation orientation,
            float displacement,
            float sensitivityRed,
            float sensitivityBlue)
            : base(handle, displacement, sensitivityRed)
        {
            this._input       = input;
            this._orientation = orientation;

            _event_handler         = GetHandler(orientation);
            _input.BalanceChanged += _event_handler;

            _analyzer_handler     = new EventHandler <BalanceChangedEventArgs>(_analyzer_handle);
            input.BalanceChanged += _analyzer_handler;
        }
Example #2
0
        private InputBinding ConfigureBalanceBoard(
            XPathNavigator navigator, XPathNodeIterator bindingIt, IBalanceBoardInput input)
        {
            string point       = bindingIt.Current.GetAttribute("point", "");
            float  zeroAngle   = float.Parse(bindingIt.Current.GetAttribute("zeroAngle", ""), CultureInfo.InvariantCulture);
            float  sensitivity = float.Parse(bindingIt.Current.GetAttribute("sensitivity", ""), CultureInfo.InvariantCulture);

            XPathNodeIterator acc = bindingIt.Current.Select("balanceBoard");

            if (acc.Count > 0)
            {
                acc.MoveNext();
                string device  = acc.Current.GetAttribute("device", "");
                string strAxis = acc.Current.GetAttribute("axis", "");
                BalanceBoardBinding.MovementOrientation axis = (BalanceBoardBinding.MovementOrientation)Enum.Parse(typeof(BalanceBoardBinding.MovementOrientation), strAxis);
                return(new BalanceBoardBinding(input, Configuration.GetHandle(point), axis, zeroAngle, sensitivity, sensitivity));
            }
            return(null);
        }