Esempio n. 1
0
        /// <summary>
        /// [MOVE-1] On Pointer Moved
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <remarks>
        /// by Finger
        /// by OnPointerPressed
        /// Coodinations are in "On Pointer Pressed"
        /// </remarks>
        private void OnPointerMoved(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.PointerEventArgs e)
        {
            var po = _(e, this, "OnPointerMoved");

            po.FingerCount = FingerCount;
            Move           = po.Clone();
            //Debug.WriteLine(___(po));

            if (po.DeviceType == PointerState.DeviceTypes.Mouse)
            {
                if (IsOnManipulationStarted == false)
                {
                    po.PositionOrigin = StartPosition;
                    KickPointerEvent("OnPointerMoved", fc => fc.OnPointerMoved(po));
                }
            }
        }
Esempio n. 2
0
        private void CoreWindow_KeyUp(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs args)
        {
            if (args.VirtualKey == Windows.System.VirtualKey.R)
            {
                _stateMachine.OnKeyRadio();
            }

            if (args.VirtualKey == Windows.System.VirtualKey.A)
            {
                _stateMachine.OnKeyAlarm();
            }

            if (args.VirtualKey == Windows.System.VirtualKey.S)
            {
                _stateMachine.OnKeySnooze();
            }
        }
Esempio n. 3
0
        private void CoreWindow_KeyUp(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs args)
        {
            switch (args.VirtualKey)
            {
            case VirtualKey.Up:
                UpPressed = false;
                break;

            case VirtualKey.Left:
                LeftPressed = false;
                break;

            case VirtualKey.Right:
                RightPressed = false;
                break;
            }
        }
Esempio n. 4
0
 /// <summary>
 /// Fired when a key is pressed down on the main window
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void CoreWindow_KeyDown(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs e)
 {
     if (e.VirtualKey == Windows.System.VirtualKey.Control)
     {
         m_isControlKeyDown = true;
     }
     else if (m_isControlKeyDown)
     {
         // I had this on the key down event but it didn't seem to fire 100%
         // reliably. So this place seems to work better.
         if (e.VirtualKey == Windows.System.VirtualKey.S)
         {
             // Fire the event
             m_onQuickSearchActivation.Raise(this, new EventArgs());
             e.Handled = true;
         }
     }
 }
Esempio n. 5
0
        void OnVisibilityChanged(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.VisibilityChangedEventArgs args)
        {
            lock (_renderSurfaceLock) {
                if (args.Visible && _renderSurface == IntPtr.Zero)
                {
                    CreateRenderSurface();
                }

                if (args.Visible && _renderSurface != IntPtr.Zero)
                {
                    StartRenderLoop();
                }
                else
                {
                    StopRenderLoop();
                }
            }
        }
Esempio n. 6
0
 private void KeyUp_Handler(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs e)
 {
     if (e.VirtualKey == Windows.System.VirtualKey.Left)
     {
         leftKeyDown = false;
     }
     else if (e.VirtualKey == Windows.System.VirtualKey.Right)
     {
         rightKeyDown = false;
     }
     else if (e.VirtualKey == Windows.System.VirtualKey.A)
     {
         aKeyDown = false;
     }
     else if (e.VirtualKey == Windows.System.VirtualKey.D)
     {
         dKeyDown = false;
     }
 }
 private void KeyDown_Handler(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs e)
 {
     if (e.VirtualKey == Windows.System.VirtualKey.A)
     {
         aKeyDown = true;
     }
     else if (e.VirtualKey == Windows.System.VirtualKey.D)
     {
         dKeyDown = true;
     }
     else if (e.VirtualKey == Windows.System.VirtualKey.W)
     {
         if (paused != true)
         {
             acceleration[0] += 1;
         }
     }
     else if (e.VirtualKey == Windows.System.VirtualKey.S)
     {
         if (paused != true)
         {
             acceleration[0] -= 1;
         }
     }
     else if (e.VirtualKey == Windows.System.VirtualKey.Q || e.VirtualKey == Windows.System.VirtualKey.Escape)
     {
         if (!paused)
         {
             accelBeforePause = acceleration[0];
             acceleration[0]  = 0;
             paused           = true;
             displayOptions();
         }
     }
     else if (e.VirtualKey == Windows.System.VirtualKey.B)
     {
         addBall(paddleTop + 20, leftBound + 20, getRandomColor());
         acc.Add(new List <int>()
         {
             5, 40 + random.Next(-10, 10)
         });
     }
 }
Esempio n. 8
0
        //-------------------------------------------------------------------------------------
        // Constructors

        public GameHost()
        {
            // Create new collections
            Textures     = new Dictionary <string, Texture2D>();
            Fonts        = new Dictionary <string, SpriteFont>();
            Models       = new Dictionary <string, Model>();
            GameObjects  = new List <GameObjectBase>();
            SoundEffects = new Dictionary <string, SoundEffect>();
            Songs        = new Dictionary <string, Song>();

            // Create other objects
            SettingsManager.Game = this;
            HighScores           = new HighScores(this);

#if NETFX_CORE
            // Get a reference to the Windows 8 game window
            _window = Windows.UI.Core.CoreWindow.GetForCurrentThread();
#endif
        }
        private void KeyboardListenerService_KeyDownPressed(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs args)
        {
            switch (args.VirtualKey)
            {
            case VirtualKey.GamepadView:
                ShowFlyout();
                break;

            case VirtualKey.GamepadY:
                if ((this.DataContext as IVLCStorageItem).StorageItem != null)
                {
                    Locator.FileExplorerVM.CurrentStorageVM.CopyCommand.Execute(this.DataContext);
                }
                break;

            default:
                break;
            }
        }
Esempio n. 10
0
 void CoreWindow_PointerWheelChanged(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.PointerEventArgs args)
 {
     if (args.KeyModifiers != Windows.System.VirtualKeyModifiers.Control)
     {
         return;
     }
     if (args.CurrentPoint.Properties.MouseWheelDelta < 0)
     {
         firstDate = firstDate.AddDays(1);
         Refresh();
         //下一日
     }
     else
     {
         //上一日
         firstDate = firstDate.AddDays(-1);
         Refresh();
     }
 }
        private void RealTimeSpaceKeyDown(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs args)
        {
            if (args.VirtualKey == Windows.System.VirtualKey.Space)
            {
                switch (timerStatus)
                {
                case TimerStatus.Timing:
                    timerStatus = TimerStatus.Display;
                    StopTimer();

                    TimerTextBlock.Foreground = RedBrush;
                    break;

                case TimerStatus.Waiting:
                    if (!needObserving)
                    {
                        StartHoldingTick();
                    }
                    else
                    {
                        TimerTextBlock.Foreground = YellowBrush;
                    }
                    break;

                case TimerStatus.Observing:
                    StartHoldingTick();
                    break;

                case TimerStatus.Display:
                    TimerTextBlock.Foreground = RedBrush;
                    break;

                default:
                    if (!(timerStatus == TimerStatus.Holding))
                    {
                        TimerTextBlock.Foreground = YellowBrush;
                    }
                    break;
                }
                RefreshStatusTextBlock();
            }
        }
Esempio n. 12
0
        void inputKeyDown(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs args)
        {
            switch (args.VirtualKey.ToString())
            {
            case "Space": _lcd.prints(" ");
                break;

            case "Enter": _lcd.gotoSecondLine();
                break;

            case "Back": _lcd.clrscr();
                break;

            case "Control":
                if (this.backLight)
                {
                    _lcd.turnOffBacklight();
                }
                else
                {
                    _lcd.turnOnBacklight();
                }
                this.backLight = !this.backLight;
                break;

            case "Shift":    //do nothing
            case "Menu":     //do nothing
                break;

            case "Number1": _lcd.prints("1");
                break;

            case "Number2": _lcd.prints("2");
                break;

            case "Number3": _lcd.prints("3");
                break;

            default: _lcd.prints(args.VirtualKey.ToString());
                break;
            }
        }
Esempio n. 13
0
        // Method for releasing the keyboard press
        private void onKeyUp(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs args)
        {
            if (Player2 == false)
            {
                if (left == true && args.VirtualKey == VirtualKey.Left) // checks is bool left is true and if left button is actually pressed
                {
                    left = false;
                }
                if (up == true && args.VirtualKey == VirtualKey.Up) // checks is bool up is true and if up button is actually pressed
                {
                    up = false;
                }
                if (right == true && args.VirtualKey == VirtualKey.Right) // checks is bool right is true and if right button is actually pressed
                {
                    right = false;
                }
                if (down == true && args.VirtualKey == VirtualKey.Down) // checks is bool down is true and if down button is actually pressed
                {
                    down = false;
                }
            }

            if (Player2 == true)
            {
                if (left == true && args.VirtualKey == VirtualKey.A) // checks is bool left is true and if left button is actually pressed
                {
                    left = false;
                }
                if (up == true && args.VirtualKey == VirtualKey.W) // checks is bool up is true and if up button is actually pressed
                {
                    up = false;
                }
                if (right == true && args.VirtualKey == VirtualKey.D) // checks is bool right is true and if right button is actually pressed
                {
                    right = false;
                }
                if (down == true && args.VirtualKey == VirtualKey.S) // checks is bool down is true and if down button is actually pressed
                {
                    down = false;
                }
            }
        }
Esempio n. 14
0
        private void CoreWindow_PointerReleased(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.PointerEventArgs args)
        {
            var under = VisualTreeHelper.FindElementsInHostCoordinates(args.CurrentPoint.Position, Window.Current.Content);

            var allowed = true;

            foreach (UIElement elem in under)
            {
                if (elem is MenuBarButton)
                {
                    allowed = false;
                    break;
                }
            }

            if (CurrentButton != null && allowed)
            {
                CurrentButton.ToggleMenu();
            }
        }
Esempio n. 15
0
        private void ChangedCoreWindowPointerWheel(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.PointerEventArgs args)
        {
            Windows.UI.Input.PointerPoint currentPoint = args.CurrentPoint;
            double mouseWheelDelta = currentPoint.Properties.MouseWheelDelta;

            if (args.KeyModifiers == Windows.System.VirtualKeyModifiers.None)
            {
                DateTime dateTime = DateTime.Now;
                if (mouseWheelDelta > 0)
                {
                    i--;
                }
                else
                {
                    i++;
                }
                dateTime = dateTime.AddMonths(i);
                _calenderView.Paint(dateTime.Year, dateTime.Month, dateTime.Day);
            }
        }
Esempio n. 16
0
 private void CoreWindow_KeyDown(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs args)
 {
     if (args.VirtualKey == Windows.System.VirtualKey.Escape)
     {
         var view = ApplicationView.GetForCurrentView();
         if (view.IsFullScreenMode)
         {
             view.ExitFullScreenMode();
         }
         //else
         //{
         //    view.TryEnterFullScreenMode();
         //}
         //if (args.VirtualKey == Windows.System.VirtualKey.Escape)
         //{
         //   // CoreApplication.Exit();
         //    // Application.Current.Exit();
         //}
     }
 }
Esempio n. 17
0
        void CoreWindow_PointerWheelChanged(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.PointerEventArgs args)
        {
            if (Carousel.IsAnimating)
            {
                return;
            }

            latestMouseWheelEvent = DateTime.Now;
            latestMouseWheelDelta = args.CurrentPoint.Properties.MouseWheelDelta;

            var animatedScrollPosition = Carousel.AnimatedScrollPosition;

            animatedScrollPosition += latestMouseWheelDelta * 0.1;
            if (animatedScrollPosition == -360)
            {
                Carousel.ScrollPosition = 30;
                animatedScrollPosition  = 0;
            }
            Carousel.AnimatedScrollPosition = animatedScrollPosition;
        }
Esempio n. 18
0
        /// <summary>
        /// Constructs a new MapView object.
        /// </summary>
        public MapView()
        {
            _baseMapView = new BaseMapView();

            InitializeComponent();

            this.Loaded += new Windows.UI.Xaml.RoutedEventHandler(OnPageLoaded);

            Windows.UI.Core.CoreWindow window = Windows.UI.Xaml.Window.Current.CoreWindow;
            window.VisibilityChanged += new Windows.Foundation.TypedEventHandler <Windows.UI.Core.CoreWindow, Windows.UI.Core.VisibilityChangedEventArgs> (OnVisibilityChanged);

            _swapChainPanel.SizeChanged += new Windows.UI.Xaml.SizeChangedEventHandler(OnSwapChainPanelSizeChanged);
            _swapChainPanelSize          = new Windows.Foundation.Size(_swapChainPanel.RenderSize.Width, _swapChainPanel.RenderSize.Height);

            Windows.Graphics.Display.DisplayInformation dispInfo = Windows.Graphics.Display.DisplayInformation.GetForCurrentView();
            _resolutionScale = (float)dispInfo.RawPixelsPerViewPixel;
            _baseMapView.GetOptions().DPI = (float)dispInfo.RawDpiX;

            _baseMapView.SetRedrawRequestListener(new MapViewRedrawRequestListener(this));
        }
Esempio n. 19
0
 private void KeyDown_Handler(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs e)
 {
     if (e.VirtualKey == Windows.System.VirtualKey.Left)
     {
         leftKeyDown = true;
     }
     else if (e.VirtualKey == Windows.System.VirtualKey.Right)
     {
         rightKeyDown = true;
     }
     else if (e.VirtualKey == Windows.System.VirtualKey.A)
     {
         aKeyDown = true;
     }
     else if (e.VirtualKey == Windows.System.VirtualKey.D)
     {
         dKeyDown = true;
     }
     else if (e.VirtualKey == Windows.System.VirtualKey.Space)
     {
         ballSpeed++;
     }
     else if (e.VirtualKey == Windows.System.VirtualKey.Shift)
     {
         ballSpeed--;
     }
     else if (e.VirtualKey == Windows.System.VirtualKey.B)
     {
         //var rectangle = new Rectangle();
         //rectangle.Name = "Obstacle";
         //rectangle.Fill = GetRandomColor();
         //rectangle.Stroke = new SolidColorBrush( Color.FromArgb( 255, 255, 255, 255 ) );
         //rectangle.Margin = new Thickness( random.Next((int)LeftWall.Margin.Left, (int)RightWall.Margin.Left), 100, 0, 0 );
         //rectangle.Height = 50;
         //rectangle.Width = 100;
         //rectangle.HorizontalAlignment = HorizontalAlignment.Left;
         //rectangle.VerticalAlignment = VerticalAlignment.Top;
         //bricks.Add( rectangle );
         //Grid.Children.Add( rectangle );
     }
 }
Esempio n. 20
0
        private void CoreWindow_KeyUp(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs args)
        {
            if (args.VirtualKey == VirtualKey.GamepadRightTrigger && !bottomCommandBar.IsOpen)
            {
                if (bottomCommandBar.ClosedDisplayMode == AppBarClosedDisplayMode.Minimal)
                {
                    bottomCommandBar.IsEnabled         = false;
                    bottomCommandBar.ClosedDisplayMode = AppBarClosedDisplayMode.Hidden;
                }
                else
                {
                    bottomCommandBar.IsEnabled         = true;
                    bottomCommandBar.ClosedDisplayMode = AppBarClosedDisplayMode.Minimal;
                }
            }

            if (args.VirtualKey == VirtualKey.GamepadLeftTrigger)
            {
                ntrInputRedirection.useGamePad = ntrInputRedirection.useGamePad ? false : true;
            }
        }
Esempio n. 21
0
        private void CoreWindow_PointerWheelChanged(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.PointerEventArgs args)
        {
            if (!IsEnabled)
            {
                return;
            }

            var pointer = args.CurrentPoint;


            if (pointer.Properties.MouseWheelDelta > 0)
            {
                Microsoft.Xaml.Interactivity.Interaction.ExecuteActions(this, this.UpActions, args);
                args.Handled = true;
            }
            else if (pointer.Properties.MouseWheelDelta < 0)
            {
                Microsoft.Xaml.Interactivity.Interaction.ExecuteActions(this, this.DownActions, args);
                args.Handled = true;
            }
        }
Esempio n. 22
0
        private void CoreWindow_KeyDown(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs args)
        {
            switch (args.VirtualKey)
            {
            case VirtualKey.Up:
                UpPressed = true;
                Debug.WriteLine("up pressed");
                break;

            case VirtualKey.Left:
                LeftPressed = true;
                break;

            case VirtualKey.Right:
                RightPressed = true;
                break;

            default:
                break;
            }
        }
Esempio n. 23
0
        private void CoreWindow_KeyDown(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs args)
        {
            switch (args.VirtualKey)
            {
            case VirtualKey.Left:
                LeftPressed = true;
                break;

            case VirtualKey.Right:
                RightPressed = true;
                break;

            case VirtualKey.Up:
                Uppressed = true;
                break;

            case VirtualKey.Down:
                Downpressed = true;
                break;
            }
        }
Esempio n. 24
0
        private void CoreWindow_KeyUp(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs args)
        {
            switch (args.VirtualKey)
            {
            case Windows.System.VirtualKey.Up:
                UpPressed = false;
                Debug.WriteLine("Up Released!");
                break;

            case Windows.System.VirtualKey.Left:
                LeftPressed = false;
                break;

            case Windows.System.VirtualKey.Right:
                RightPressed = false;
                break;

            default:
                break;
            }
        }
        private void CoreWindow_KeyDown(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs args)
        {
            switch (args.VirtualKey)
            {
            case Windows.System.VirtualKey.A:
                NextColor();
                break;

            case Windows.System.VirtualKey.B:
                NextLogo();
                break;

            case Windows.System.VirtualKey.C:
                RandomImages(10);
                break;

            case Windows.System.VirtualKey.D:
                ClearDisplay();
                break;
            }
        }
Esempio n. 26
0
        private void HotKeyDown(Windows.UI.Core.CoreWindow s, Windows.UI.Core.KeyEventArgs e)
        {
            var ctrl = Windows.UI.Xaml.Window.Current.CoreWindow.GetKeyState(VirtualKey.Control);

            if (ctrl.HasFlag(Windows.UI.Core.CoreVirtualKeyStates.Down))
            {
                switch (e.VirtualKey)
                {
                case VirtualKey.Number1:
                    rootPivot.SelectedItem = polynomPivotItem;
                    break;

                case VirtualKey.Number2:
                    rootPivot.SelectedItem = _3DPivotItem;
                    break;

                case VirtualKey.Number3:
                    rootPivot.SelectedItem = imagePivotItem;
                    break;
                }
            }
        }
Esempio n. 27
0
        private void CoreWindow_KeyDown(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs args)
        {
            switch (args.VirtualKey)
            {
            case Windows.System.VirtualKey.Right:
            case Windows.System.VirtualKey.Left:
            case Windows.System.VirtualKey.Up:
            case Windows.System.VirtualKey.Down:
                Camera.KeyDown(args.VirtualKey);
                break;

            //case Windows.System.VirtualKey.A:
            //    Debug.TimedStrings.Add(new TimedString("Test string"));
            //    break;
            case Windows.System.VirtualKey.R:
                Debug.Reset();
                break;

            case Windows.System.VirtualKey.D:
                Debug.DrawMode = (Debug.DrawMode == Debug.DRAW_MODE.BACKGROUND_COLOR) ? Debug.DRAW_MODE.TERRAIN : Debug.DRAW_MODE.BACKGROUND_COLOR;
                break;

            case Windows.System.VirtualKey.Subtract:
                if (Map.TILE_RESOLUTION > 4)
                {
                    Map.TILE_RESOLUTION /= 2;
                    Chunk.RefreshStaticData();
                }
                break;

            case Windows.System.VirtualKey.Add:
                if (Map.TILE_RESOLUTION < 64)
                {
                    Map.TILE_RESOLUTION *= 2;
                    Chunk.RefreshStaticData();
                }
                break;
            }
        }
        private void RealTimeSpaceKeyUp(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs args)
        {
            if (args.VirtualKey == Windows.System.VirtualKey.Space)
            {
                switch (timerStatus)
                {
                case TimerStatus.Waiting:
                    if (needObserving)
                    {
                        timerStatus = TimerStatus.Observing;

                        ResetTimer();
                    }
                    else
                    {
                        isHolding = false;
                    }
                    break;

                case TimerStatus.Holding:
                    timerStatus = TimerStatus.Timing;
                    StartTimer();
                    break;

                case TimerStatus.Observing:
                    isHolding = false;
                    break;

                case TimerStatus.Display:
                    timerStatus = TimerStatus.Waiting;
                    break;

                default:
                    break;
                }
                TimerTextBlock.Foreground = BlackBrush;
                RefreshStatusTextBlock();
            }
        }
Esempio n. 29
0
 /// <summary>
 /// Fired when a key is pressed down on the main window
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void CoreWindow_KeyDown(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs e)
 {
     if (e.VirtualKey == Windows.System.VirtualKey.Control)
     {
         m_isControlKeyDown = true;
     }
     else if (m_isControlKeyDown)
     {
         // I had this on the key down event but it didn't seem to fire 100%
         // reliably. So this place seems to work better.
         if (e.VirtualKey == Windows.System.VirtualKey.S)
         {
             // Disable for mobile, for some reason this can trip with the mobile keyboard.
             if (DeviceHelper.CurrentDevice() != DeviceTypes.Mobile)
             {
                 // Fire the event
                 m_onQuickSearchActivation.Raise(this, new EventArgs());
                 e.Handled = true;
             }
         }
     }
 }
Esempio n. 30
0
 private void CoreWindow_Activated(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.WindowActivatedEventArgs args)
 {
     if (args.WindowActivationState == Windows.UI.Core.CoreWindowActivationState.Deactivated)
     {
         LoggingService.LogInfo("CoreWindow Deactivated.", consoleOnly: true);
         NotepadsCore.GetSelectedTextEditor()?.StopCheckingFileStatus();
         if (EditorSettingsService.IsSessionBackupAndRestoreEnabled)
         {
             SessionManager.StopSessionBackup();
         }
     }
     else if (args.WindowActivationState == Windows.UI.Core.CoreWindowActivationState.PointerActivated ||
              args.WindowActivationState == Windows.UI.Core.CoreWindowActivationState.CodeActivated)
     {
         LoggingService.LogInfo("CoreWindow Activated.", consoleOnly: true);
         NotepadsCore.GetSelectedTextEditor()?.StartCheckingFileStatusPeriodically();
         if (EditorSettingsService.IsSessionBackupAndRestoreEnabled)
         {
             SessionManager.StartSessionBackup();
         }
     }
 }