/// <summary>
        /// Initializes a new instance of the <see cref="KeyboardInputBinding"/> class.
        /// </summary>
        /// <param name="uv">The Ultraviolet context.</param>
        /// <param name="key">A <see cref="Key"/> value representing the binding's primary key.</param>
        public KeyboardInputBinding(UltravioletContext uv, Key key)
        {
            Contract.Require(uv, "uv");

            if (!uv.GetInput().IsKeyboardSupported())
            {
                throw new NotSupportedException();
            }

            this.keyboard = uv.GetInput().GetKeyboard();
            this.key      = key;
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MouseInputBinding"/> class.
        /// </summary>
        /// <param name="uv">The Ultraviolet context.</param>
        /// <param name="button">The <see cref="MouseButton"/> value that represents the binding's primary button.</param>
        public MouseInputBinding(UltravioletContext uv, MouseButton button)
        {
            Contract.Require(uv, "uv");

            if (!uv.GetInput().IsMouseSupported())
            {
                throw new NotSupportedException();
            }

            this.mouse  = uv.GetInput().GetMouse();
            this.button = button;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="KeyboardInputBinding"/> class.
        /// </summary>
        /// <param name="uv">The Ultraviolet context.</param>
        /// <param name="key">A <see cref="Key"/> value representing the binding's primary key.</param>
        /// <param name="control">A value indicating whether the binding requires the Control modifier.</param>
        /// <param name="alt">A value indicating whether the binding requires the Alt modifier.</param>
        /// <param name="shift">A value indicating whether the binding requires the Shift modifier.</param>
        public KeyboardInputBinding(UltravioletContext uv, Key key, Boolean control, Boolean alt, Boolean shift)
        {
            if (!uv.GetInput().IsKeyboardSupported())
            {
                throw new NotSupportedException();
            }

            this.keyboard = uv.GetInput().GetKeyboard();
            this.key      = key;
            this.control  = control;
            this.alt      = alt;
            this.shift    = shift;
        }
예제 #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MouseInputBinding"/> class.
        /// </summary>
        /// <param name="uv">The Ultraviolet context.</param>
        /// <param name="button">The <see cref="MouseButton"/> value that represents the binding's primary button.</param>
        /// <param name="control">A value indicating whether the binding requires the Control modifier.</param>
        /// <param name="alt">A value indicating whether the binding requires the Alt modifier.</param>
        /// <param name="shift">A value indicating whether the binding requires the Shift modifier.</param>
        public MouseInputBinding(UltravioletContext uv, MouseButton button, Boolean control, Boolean alt, Boolean shift)
        {
            if (!uv.GetInput().IsMouseSupported())
            {
                throw new NotSupportedException();
            }

            this.mouse   = uv.GetInput().GetMouse();
            this.button  = button;
            this.control = control;
            this.alt     = alt;
            this.shift   = shift;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="KeyboardInputBinding"/> class.
        /// </summary>
        /// <param name="uv">The Ultraviolet context.</param>
        /// <param name="key">A <see cref="Key"/> value representing the binding's primary key.</param>
        public KeyboardInputBinding(UltravioletContext uv, Key key)
        {
            Contract.Require(uv, nameof(uv));

            if (!uv.GetInput().IsKeyboardSupported())
            {
                throw new NotSupportedException();
            }

            this.keyboard = uv.GetInput().GetKeyboard();
            this.key      = key;

            this.stringRepresentation = BuildStringRepresentation();
        }
예제 #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MouseInputBinding"/> class.
        /// </summary>
        /// <param name="uv">The Ultraviolet context.</param>
        /// <param name="button">The <see cref="MouseButton"/> value that represents the binding's primary button.</param>
        public MouseInputBinding(UltravioletContext uv, MouseButton button)
        {
            Contract.Require(uv, nameof(uv));

            if (!uv.GetInput().IsMouseSupported())
            {
                throw new NotSupportedException();
            }

            this.mouse  = uv.GetInput().GetMouse();
            this.button = button;

            this.stringRepresentation = BuildStringRepresentation();
        }
예제 #7
0
        public KeyboardInputBinding(UltravioletContext uv, Key key)
        {
            Contract.Require(uv, nameof(uv));

            if (!uv.GetInput().IsKeyboardSupported())
            {
                throw new NotSupportedException();
            }

            this.keyboard = uv.GetInput().GetKeyboard();
            this.key = key;

            this.stringRepresentation = BuildStringRepresentation();
        }
예제 #8
0
        public MouseInputBinding(UltravioletContext uv, MouseButton button)
        {
            Contract.Require(uv, nameof(uv));

            if (!uv.GetInput().IsMouseSupported())
            {
                throw new NotSupportedException();
            }

            this.mouse = uv.GetInput().GetMouse();
            this.button = button;

            this.stringRepresentation = BuildStringRepresentation();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="KeyboardInputBinding"/> class.
        /// </summary>
        /// <param name="uv">The Ultraviolet context.</param>
        /// <param name="key">A <see cref="Key"/> value representing the binding's primary key.</param>
        /// <param name="control">A value indicating whether the binding requires the Control modifier.</param>
        /// <param name="alt">A value indicating whether the binding requires the Alt modifier.</param>
        /// <param name="shift">A value indicating whether the binding requires the Shift modifier.</param>
        public KeyboardInputBinding(UltravioletContext uv, Key key, Boolean control, Boolean alt, Boolean shift)
        {
            if (!uv.GetInput().IsKeyboardSupported())
            {
                throw new NotSupportedException();
            }

            this.keyboard = uv.GetInput().GetKeyboard();
            this.key      = key;
            this.control  = control;
            this.alt      = alt;
            this.shift    = shift;

            this.stringRepresentation = BuildStringRepresentation();
        }
예제 #10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MouseInputBinding"/> class.
        /// </summary>
        /// <param name="uv">The Ultraviolet context.</param>
        /// <param name="button">The <see cref="MouseButton"/> value that represents the binding's primary button.</param>
        /// <param name="control">A value indicating whether the binding requires the Control modifier.</param>
        /// <param name="alt">A value indicating whether the binding requires the Alt modifier.</param>
        /// <param name="shift">A value indicating whether the binding requires the Shift modifier.</param>
        public MouseInputBinding(UltravioletContext uv, MouseButton button, Boolean control, Boolean alt, Boolean shift)
        {
            if (!uv.GetInput().IsMouseSupported())
            {
                throw new NotSupportedException();
            }

            this.mouse   = uv.GetInput().GetMouse();
            this.button  = button;
            this.control = control;
            this.alt     = alt;
            this.shift   = shift;

            this.stringRepresentation = BuildStringRepresentation();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="KeyboardInputBinding"/> class.
        /// </summary>
        /// <param name="uv">The Ultraviolet context.</param>
        /// <param name="element">The XML element that contains the binding data.</param>
        internal KeyboardInputBinding(UltravioletContext uv, XElement element)
        {
            Contract.Require(element, "element");

            this.keyboard = uv.GetInput().GetKeyboard();

            this.key = element.ElementValueEnum<Key>("Key") ?? Key.None;
            this.control = element.ElementValueBoolean("Control") ?? false;
            this.alt = element.ElementValueBoolean("Alt") ?? false;
            this.shift = element.ElementValueBoolean("Shift") ?? false; 
        }
예제 #12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MouseInputBinding"/> class.
        /// </summary>
        /// <param name="uv">The Ultraviolet context.</param>
        /// <param name="element">The XML element that contains the binding data.</param>
        internal MouseInputBinding(UltravioletContext uv, XElement element)
        {
            Contract.Require(element, "element");

            this.mouse = uv.GetInput().GetMouse();

            this.button = element.ElementValueEnum<MouseButton>("Button") ?? MouseButton.None;
            this.control = element.ElementValueBoolean("Control") ?? false;
            this.alt = element.ElementValueBoolean("Alt") ?? false;
            this.shift = element.ElementValueBoolean("Shift") ?? false; 
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="KeyboardInputBinding"/> class.
        /// </summary>
        /// <param name="uv">The Ultraviolet context.</param>
        /// <param name="element">The XML element that contains the binding data.</param>
        internal KeyboardInputBinding(UltravioletContext uv, XElement element)
        {
            Contract.Require(element, nameof(element));

            this.keyboard = uv.GetInput().GetKeyboard();

            this.key     = element.ElementValueEnum <Key>("Key") ?? Key.None;
            this.control = element.ElementValueBoolean("Control") ?? false;
            this.alt     = element.ElementValueBoolean("Alt") ?? false;
            this.shift   = element.ElementValueBoolean("Shift") ?? false;

            this.stringRepresentation = BuildStringRepresentation();
        }
예제 #14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MouseInputBinding"/> class.
        /// </summary>
        /// <param name="uv">The Ultraviolet context.</param>
        /// <param name="element">The XML element that contains the binding data.</param>
        internal MouseInputBinding(UltravioletContext uv, XElement element)
        {
            Contract.Require(element, nameof(element));

            this.mouse = uv.GetInput().GetMouse();

            this.button  = element.ElementValueEnum <MouseButton>("Button") ?? MouseButton.None;
            this.control = element.ElementValueBoolean("Control") ?? false;
            this.alt     = element.ElementValueBoolean("Alt") ?? false;
            this.shift   = element.ElementValueBoolean("Shift") ?? false;

            this.stringRepresentation = BuildStringRepresentation();
        }
예제 #15
0
        public InputResult GetInput()
        {
            if (_uv.GetInput().GetActions().SwapViews.IsPressed())
            {
                return(InputResult.SwapViews);
            }

            if (_uv.GetInput().GetActions().SpeedUp.IsPressed())
            {
                return(InputResult.SpeedUp);
            }

            if (_uv.GetInput().GetActions().SlowDown.IsPressed())
            {
                return(InputResult.SlowDown);
            }

            if (_uv.GetInput().GetActions().ExitApplication.IsPressed())
            {
                return(InputResult.Exit);
            }

            return(InputResult.Unknown);
        }