상속: ICoreWindow
 private async void CoreWindowPointerPressed(CoreWindow sender, PointerEventArgs args)
 {
     if (!_isDragUpdated)
         return;
     args.Handled = true;
     await Task.Delay(DefaultDragDelay);
     if (_valueTextBox == null)
         return;
     _valueTextBox.IsTabStop = true;
 }
        public Scenario4()
        {
            this.InitializeComponent();

            try
            {
                formatterShortDateLongTime = new DateTimeFormatter("{month.integer}/{day.integer}/{year.full} {hour.integer}:{minute.integer(2)}:{second.integer(2)}", new[] { "en-US" }, "US", Windows.Globalization.CalendarIdentifiers.Gregorian, Windows.Globalization.ClockIdentifiers.TwentyFourHour);
                formatterLongTime = new DateTimeFormatter("{hour.integer}:{minute.integer(2)}:{second.integer(2)}", new[] { "en-US" }, "US", Windows.Globalization.CalendarIdentifiers.Gregorian, Windows.Globalization.ClockIdentifiers.TwentyFourHour);
                calendar = new Calendar();
                decimalFormatter = new DecimalFormatter();
                geofenceCollection = new  ObservableCollection<GeofenceItem>();
                eventCollection = new ObservableCollection<string>();

                // Geofencing setup
                InitializeGeolocation();

                // using data binding to the root page collection of GeofenceItems
                RegisteredGeofenceListBox.DataContext = geofenceCollection;

                // using data binding to the root page collection of GeofenceItems associated with events
                GeofenceEventsListBox.DataContext = eventCollection;

                coreWindow = CoreWindow.GetForCurrentThread(); // this needs to be set before InitializeComponent sets up event registration for app visibility
                coreWindow.VisibilityChanged += OnVisibilityChanged;
            }
            catch (Exception ex)
            {
                // GeofenceMonitor failed in adding a geofence
                // exceptions could be from out of memory, lat/long out of range,
                // too long a name, not a unique name, specifying an activation
                // time + duration that is still in the past
                _rootPage.NotifyUser(ex.ToString(), NotifyType.ErrorMessage);
            }
        }
예제 #3
0
        /// <summary>
        ///     当此页处于活动状态并占用整个窗口时,在每次鼠标单击、触摸屏点击
        ///     或执行等效交互时调用。    用于检测浏览器样式下一页和
        ///     上一步鼠标按钮单击以在页之间导航。
        /// </summary>
        /// <param name="sender">触发事件的实例。</param>
        /// <param name="e">描述导致事件的条件的事件数据。</param>
        private void CoreWindow_PointerPressed(Windows.UI.Core.CoreWindow sender,
                                               PointerEventArgs e)
        {
            PointerPointProperties properties = e.CurrentPoint.Properties;

            // 忽略与鼠标左键、右键和中键的键关联
            if (properties.IsLeftButtonPressed || properties.IsRightButtonPressed ||
                properties.IsMiddleButtonPressed)
            {
                return;
            }

            // 如果按下后退或前进(但不是同时),则进行相应导航
            bool backPressed    = properties.IsXButton1Pressed;
            bool forwardPressed = properties.IsXButton2Pressed;

            if (backPressed ^ forwardPressed)
            {
                e.Handled = true;
                if (backPressed)
                {
                    GoBackCommand.Execute(null);
                }
                if (forwardPressed)
                {
                    GoForwardCommand.Execute(null);
                }
            }
        }
예제 #4
0
파일: Program.cs 프로젝트: Nezz/SharpDX
            /// <inheritdoc/>
            public void SetWindow(CoreWindow window)
            {
                this.window = window;

                // Safely dispose any previous instance
                RemoveAndDispose(ref deviceManager);
                RemoveAndDispose(ref target);
                RemoveAndDispose(ref cubeRenderer);

                // Creates a new DeviceManager (Direct3D, Direct2D, DirectWrite, WIC)
                deviceManager = ToDispose(new DeviceManager());

                // Use CoreWindowTarget as the rendering target (Initialize SwapChain, RenderTargetView, DepthStencilView, BitmapTarget)
                target = ToDispose(new CoreWindowTarget(window));

                // New CubeRenderer
                cubeRenderer = ToDispose(new CubeRenderer());
                var fpsRenderer = new FpsRenderer();

                // Add Initializer to device manager
                deviceManager.OnInitialize += target.Initialize;
                deviceManager.OnInitialize += cubeRenderer.Initialize;
                deviceManager.OnInitialize += fpsRenderer.Initialize;

                // Render the cube within the CoreWindow
                target.OnRender += cubeRenderer.Render;
                target.OnRender += fpsRenderer.Render;

                // Initialize the device manager and all registered deviceManager.OnInitialize 
                deviceManager.Initialize(DisplayProperties.LogicalDpi);
            }
예제 #5
0
 public void SetWindow(Windows.UI.Core.CoreWindow window)
 {
     RemoveAndDispose(ref d3dApp);
     this.window = window;
     d3dApp      = ToDispose(new D3DApp(window));
     d3dApp.Initialize();
 }
예제 #6
0
		private void pointerMoved(CoreWindow sender, PointerEventArgs e)
		{
			theEvent.Type = ApplicationEventTypes.MouseMove;
			var loc = e.CurrentPoint.RawPosition;
			theEvent.CursorPosition = new Point2((int)loc.X, (int)loc.Y);
			handleEvent(theEvent);
		}
예제 #7
0
 private void CoreWindow_KeyDown(CoreWindow sender, KeyEventArgs args)
 {
     if (args.VirtualKey == VirtualKey.Escape)
     {
         Reset();
     }
 }
예제 #8
0
 private void HandleKeyDown(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs args)
 {
     if (args.VirtualKey == Windows.System.VirtualKey.Right)
     {
         MqttPublish("turn right");
     }
     else if (args.VirtualKey == Windows.System.VirtualKey.Left)
     {
         MqttPublish("turn left");
     }
     else if (args.VirtualKey == Windows.System.VirtualKey.Up)
     {
         MqttPublish("move forward");
     }
     else if (args.VirtualKey == Windows.System.VirtualKey.Down)
     {
         MqttPublish("move backward");
     }
     else if (args.VirtualKey == Windows.System.VirtualKey.Escape)
     {
         MqttPublish("stop");
     }
     else if (args.VirtualKey == Windows.System.VirtualKey.R)
     {
         MqttPublish("rotate right");
     }
     else if (args.VirtualKey == Windows.System.VirtualKey.L)
     {
         MqttPublish("rotate left");
     }
 }
 private void CoreWindow_CharacterReceived(Windows.UI.Core.CoreWindow sender, CharacterReceivedEventArgs args)
 {
     if (_internalFocus)
     {
         OnTextInput((char)args.KeyCode);
     }
 }
예제 #10
0
        private void MainPage_KeyDown(CoreWindow sender, KeyEventArgs args)
        {
            if (args.VirtualKey.Equals(VirtualKey.P) || args.VirtualKey.Equals(VirtualKey.Pause))
            {
                if (pause)
                    pause = true;
                else
                    pause = false;
            }
            if (args.VirtualKey.Equals(VirtualKey.Left)) //Bewegt die Bilder nach Links
            {
                CoverFlowControl.PreviousItem();
            }
            if (args.VirtualKey.Equals(VirtualKey.Right)) //Bewegt die Bilder nach Rechts
            {
                CoverFlowControl.NextItem();
            }

            if (args.VirtualKey.Equals(VirtualKey.R)) //Rotiert nach Rechts
            {
                
                CoverFlowControl.SelectedCoverItem.ZRotation -= 90;
            }
            if (args.VirtualKey.Equals(VirtualKey.L)) //Rotiert nach Rechts
            {

                CoverFlowControl.SelectedCoverItem.ZRotation += 90;
            }


        }
예제 #11
0
        void CoreWindow_KeyDown(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs e)
        {
            switch (e.VirtualKey)
            {
            case Windows.System.VirtualKey.Escape:
            case Windows.System.VirtualKey.GamepadB:
                //Se cambia de página

                if (firstPerson)
                {
                    firstPerson = false;
                    BetweenPageParameter param = new BetweenPageParameter();
                    param.Time = seconds;
                    this.Frame.Navigate(typeof(InGameMap), param);
                }
                break;

            case Windows.System.VirtualKey.Space:
                //Daño demostrativo de la barra de vida
                UpdateHealth(10);
                break;

            case Windows.System.VirtualKey.Tab:
                //Se expande/se minimiza el mapa
                UpdateMap();
                break;

            default:
                break;
            }
        }
예제 #12
0
 public static void Initialize()
 {
     _window = CoreWindow.GetForCurrentThread();
     _windowsBounds = _window.Bounds;
     _windowState = WindowState.Full;
     _window.SizeChanged += _window_SizeChanged;
 }
예제 #13
0
#pragma warning disable CC0091 // Use static method
#pragma warning disable CC0057 // Unused parameters
        public static void OnCharacterReceived(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.CharacterReceivedEventArgs args)
#pragma warning restore CC0057 // Unused parameters
#pragma warning restore CC0091 // Use static method
        {
            //System.Diagnostics.Debug.WriteLine("HardwareKeyPageRenderer.OnCharacterReceived");
            ProcessCharacter(HardwareKeyPage.FocusedElement ?? HardwareKeyPage.DefaultFocusedElement, (char)args.KeyCode);
        }
예제 #14
0
파일: Notifier.cs 프로젝트: umu24013/Chat
 private void FrontendVisibilityChanged(Windows.UI.Core.CoreWindow sender, VisibilityChangedEventArgs args)
 {
     windowVisible     = args.Visible;
     NotificationCount = 0;
     errorState        = false;
     UpdateBadge();
 }
예제 #15
0
        /// <summary>
        /// Initialise the input system. Note that accelerometer input defaults to off.
        /// </summary>
        /// <param name="game"></param>
        public InputManager(Project2Game game) : base(game)
        {

            // initialisation
            useMouseDelta = false;
            accelerometerEnabled = false;
            mouseDelta = new Vector2();

            keyboardManager = new KeyboardManager(game);
            mouseManager = new MouseManager(game);
            pointerManager = new PointerManager(game);
            keyMapping = new KeyMapping();

            // get the accelerometer. Returns null if no accelerometer found
            accelerometer = Accelerometer.GetDefault();
            window = Window.Current.CoreWindow;

            // Set up the gesture recognizer.  In this game, it only responds to TranslateX, TranslateY and Tap events
            gestureRecognizer = new Windows.UI.Input.GestureRecognizer();
            gestureRecognizer.GestureSettings = GestureSettings.ManipulationTranslateX | 
                GestureSettings.ManipulationTranslateY | GestureSettings.Tap;
            
            // Register event handlers for pointer events
            window.PointerPressed += OnPointerPressed;
            window.PointerMoved += OnPointerMoved;
            window.PointerReleased += OnPointerReleased;
            
            // automatically enable accelerometer if we have one
            this.AccelerometerEnabled(true);
            this.MouseDeltaEnabled(true);
            
        }
예제 #16
0
        private void Charac_KeyDown(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs e)
        {
            if (!isFalling)
            {
                if (e.VirtualKey == Windows.System.VirtualKey.A || e.VirtualKey == Windows.System.VirtualKey.Left)
                {
                    moveLeft = true;
                }
                else if (e.VirtualKey == Windows.System.VirtualKey.D || e.VirtualKey == Windows.System.VirtualKey.Right)
                {
                    moveRight = true;
                }

                if (e.VirtualKey == Windows.System.VirtualKey.W || e.VirtualKey == Windows.System.VirtualKey.Up)
                {
                    Jump();
                }
            }
            else
            {
                if (e.VirtualKey == Windows.System.VirtualKey.A || e.VirtualKey == Windows.System.VirtualKey.Left)
                {
                    prepLeft = true;
                }
                else if (e.VirtualKey == Windows.System.VirtualKey.D || e.VirtualKey == Windows.System.VirtualKey.Right)
                {
                    prepRight = true;
                }
            }
        }
예제 #17
0
        private void CoreWindow_KeyDown(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs args)
        {
            if (args.VirtualKey == Windows.System.VirtualKey.F12)
            {
                args.Handled = true;

                var view = ApplicationView.GetForCurrentView();
                if (view.IsFullScreenMode)
                {
                    fullscreen = false;
                    view.ExitFullScreenMode();
                    ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.Auto;
                    // The SizeChanged event will be raised when the exit from full-screen mode is complete.
                }
                else
                {
                    if (view.TryEnterFullScreenMode())
                    {
                        fullscreen = true;
                        ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.FullScreen;
                        // The SizeChanged event will be raised when the entry to full-screen mode is complete.
                    }
                }
            }
            else
            {
                Sprite.SendKeyPressed(args);
            }
        }
예제 #18
0
        private void CoreWindow_KeyDown(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs args)
        {
            if (!IsEnabled)
            {
                return;
            }
            if (args.Handled)
            {
                return;
            }

            if (this.ShiftKey && (Window.Current.CoreWindow.GetKeyState(VirtualKey.Shift) & CoreVirtualKeyStates.Down) != CoreVirtualKeyStates.Down)
            {
                return;
            }

            if (this.CtrlKey && (Window.Current.CoreWindow.GetKeyState(VirtualKey.Control) & CoreVirtualKeyStates.Down) != CoreVirtualKeyStates.Down)
            {
                return;
            }

            if (this.Key == args.VirtualKey)
            {
                foreach (var action in Actions)
                {
                    (action as IAction).Execute(this.AssociatedObject, args);
                }
                args.Handled = true;
            }
        }
예제 #19
0
 public NotificationService(IConvertService convertService,IUserDataRepository userDataRepository)
 {
     Current = ApplicationData.Current.LocalSettings;
     _convertService = convertService;
     _userDataRepository = userDataRepository;
     _coreWindow = Window.Current.CoreWindow;
 }
 private void Page_KeyRouted(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs args)
 {
     if (args.VirtualKey >= Windows.System.VirtualKey.GamepadA && args.VirtualKey <= Windows.System.VirtualKey.GamepadRightThumbstickLeft)
     {
         args.Handled = true;
     }
 }
        public void OnKeyDown(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs e)
        {
            if (e.VirtualKey == Windows.System.VirtualKey.Enter)
            {
                this.userGuid = Hasher.GetSmartCardHash(sb.ToString());
                Debug.WriteLine(userGuid);
                KegLogger.KegLogTrace("User", "UserScan", Microsoft.ApplicationInsights.DataContracts.SeverityLevel.Information, new Dictionary <string, string>()
                {
                    { "hashcode", this.userGuid }
                });

                //resetting
                sb.Clear();
                bool status = CheckKegStatus();

                if (!status)
                {
                    //Appropriate messages are handled in above method
                    this.userGuid = string.Empty;
                    return;
                }

                Window.Current.CoreWindow.KeyDown -= OnKeyDown;
                //cardDetected = true;
                this.Frame.Navigate(typeof(Page2), $"FromMain:{userGuid}");
            }
            else
            {
                sb.Append((int)e.VirtualKey - 48);
            }
        }
예제 #22
0
        private void CoreWindow_KeyDown(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs args)
        {
            if (OnlyWhenFocus != null && !_NowFocusing_OnlyWhenFocus)
            {
                return;
            }
            if (!IsEnabled)
            {
                return;
            }
            if (args.Handled)
            {
                return;
            }

            if (this.ShiftKey && (Window.Current.CoreWindow.GetKeyState(VirtualKey.Shift) & CoreVirtualKeyStates.Down) != CoreVirtualKeyStates.Down)
            {
                return;
            }

            if (this.CtrlKey && (Window.Current.CoreWindow.GetKeyState(VirtualKey.Control) & CoreVirtualKeyStates.Down) != CoreVirtualKeyStates.Down)
            {
                return;
            }

            if (!IsEnableUINavigationButtons)
            {
                if (NavigationButtonVirtualKeyList.Any(x => x == args.VirtualKey))
                {
                    return;
                }

                var keycode = (int)args.VirtualKey;
                if (IgnoreVirtualKeyList.Any(x => x == keycode))
                {
                    return;
                }
            }

            if (this.Key == VirtualKey.None || this.Key == args.VirtualKey)
            {
                foreach (var action in this.Actions.Cast <IAction>())
                {
                    var result = action.Execute(this, args);
                    if (result is bool)
                    {
                        var isExecuted = (bool)result;
                        if (!isExecuted)
                        {
                            return;
                        }
                        args.Handled = true;
                    }
                    else
                    {
                        args.Handled = true;
                    }
                }
            }
        }
예제 #23
0
        private void CoreWindowOnKeyDown(CoreWindow Sender, KeyEventArgs Args)
        {
            MoveDirection? direction = null;
            if (Args.VirtualKey == VirtualKey.Up)
            {
                direction = MoveDirection.Up;
            }
            else if (Args.VirtualKey == VirtualKey.Down)
            {
                direction = MoveDirection.Down;
            }
            else if (Args.VirtualKey == VirtualKey.Left)
            {
                direction = MoveDirection.Left;
            }
            else if (Args.VirtualKey == VirtualKey.Right)
            {
                direction = MoveDirection.Right;
            }

            if (direction != null)
            {
                _gameGrid.HandleMove(direction.Value);
            }
        }
예제 #24
0
 private void OnKeyDown(CoreWindow sender, KeyEventArgs args)
 {
     if (!isInPage)
         return;
     if (args.VirtualKey == VirtualKey.Back && word.FocusState == FocusState.Unfocused)
         OnDelClicked(del, null);
 }
예제 #25
0
        public InputEvents(CoreWindow window, UIElement inputElement, TouchQueue touchQueue)
        {
            _touchQueue = touchQueue;

            // The key events are always tied to the window as those will
            // only arrive here if some other control hasn't gotten it.
            window.KeyDown += CoreWindow_KeyDown;
            window.KeyUp += CoreWindow_KeyUp;
            window.VisibilityChanged += CoreWindow_VisibilityChanged;

            if (inputElement != null)
            {
                // If we have an input UIElement then we bind input events
                // to it else we'll get events for overlapping XAML controls.
                inputElement.PointerPressed += UIElement_PointerPressed;
                inputElement.PointerReleased += UIElement_PointerReleased;
                inputElement.PointerCanceled += UIElement_PointerReleased;
                inputElement.PointerMoved += UIElement_PointerMoved;
                inputElement.PointerWheelChanged += UIElement_PointerWheelChanged;
            }
            else
            {
                // If we only have a CoreWindow then use it for input events.
                window.PointerPressed += CoreWindow_PointerPressed;
                window.PointerReleased += CoreWindow_PointerReleased;
                window.PointerMoved += CoreWindow_PointerMoved;
                window.PointerWheelChanged += CoreWindow_PointerWheelChanged;
            }
        }
        private void CoreWindow_KeyDown(Windows.UI.Core.CoreWindow sender, KeyEventArgs args)
        {
            //use a switch
            switch (args.VirtualKey)
            {
            case VirtualKey.Down:
                // do something
                Debug.WriteLine("Pressed down");
                break;

            case VirtualKey.Up:
                // do something
                Debug.WriteLine("Pressed up");
                break;

            case VirtualKey.Left:
                // do something
                Debug.WriteLine("Pressed left");
                break;

            case VirtualKey.Right:
                // do something
                Debug.WriteLine("Pressed right");
                break;
            }
            if (args.VirtualKey == Windows.System.VirtualKey.Left)
            {
            }
        }
예제 #27
0
		public void SetWindow(CoreWindow window)
		{
			if (CoreWindow != window) window.VisibilityChanged += visibilityChanged;

			CoreWindow = window;
			if (coreMetroWindow != null) coreMetroWindow.Dispose();
			coreMetroWindow = new CoreMetroWindow(this, window, theEvent, true);
		}
예제 #28
0
 private void CoreWindow_KeyDown(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs args)
 {
     if (!_listening && !_gamepadViewDown && args.VirtualKey == Windows.System.VirtualKey.GamepadView)
     {
         _gamepadViewDown = true;
         _keyTimer.Start();
     }
 }
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.  The Parameter
        /// property is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            ButtonInitialize.Click += new RoutedEventHandler(initDevice);
            ButtonIncomingCall.Click += new RoutedEventHandler(newIncomingCall);
            ButtonHangUp.Click += new RoutedEventHandler(hangUp);

            _cw = Window.Current.CoreWindow;
        }
        public void SetWindow(CoreWindow window)
        {
            _window = window;

            InitializeCompositor();

            BuildVisualTree();
        }
예제 #31
0
        //------------------------------------------------------------------------------
        //
        // VisualProperties.SetWindow
        //
        // This method is called when the CoreApplication has created a new CoreWindow,
        // allowing the application to configure the window and start producing content
        // to display.
        //
        //------------------------------------------------------------------------------

        void IFrameworkView.SetWindow(CoreWindow window)
        {
            _window = window;
            InitNewComposition();
            _window.PointerPressed += OnPointerPressed;
            _window.PointerMoved += OnPointerMoved;
            _window.PointerReleased += OnPointerReleased;
        }
예제 #32
0
 private void CoreWindow_KeyUp(CoreWindow sender, KeyEventArgs args)
 {
     if (args.VirtualKey == VirtualKey.Down)
     {
         gameTask.SpeedDown(SPEED_VAR);
         speedUp = false;
     }
 }
예제 #33
0
파일: Xmpp.cs 프로젝트: gchatapp/GchatWin
 private async Task message(CoreWindow window, string message) {
     if (Message != null && window != null) {
         await window.Dispatcher.RunAsync(0, () =>
         {
             Message(this, new CallbackData() { Data = message });
         });
     }
 }
예제 #34
0
파일: Xmpp.cs 프로젝트: gchatapp/GchatWin
 private async Task disconnect(CoreWindow window, string message) {
     if (Disconnect != null && window != null) {
         await window.Dispatcher.RunAsync(0, () =>
         {
             Disconnect(this, message);
         });
     }
 }
예제 #35
0
        /// <summary>
        /// Initialzies a new <see cref="CoreWindowTarget"/> instance.
        /// </summary>
        /// <param name="window"></param>
        public CoreWindowTarget(CoreWindow window)
        {
            this.window = window;

            // Register event on Window Size Changed
            // So that resources dependent size can be resized
            window.SizeChanged += window_SizeChanged;
        }
예제 #36
0
파일: Xmpp.cs 프로젝트: gchatapp/GchatWin
 private async Task log(CoreWindow window, string message) {
     if (Log != null && window != null) {
         await window.Dispatcher.RunAsync(0, () =>
         {
             Log(this, message);
         });
     }
 }
        public D3DAppCoreWindowTarget(CoreWindow window)
        {
            _window = window;

            Window.SizeChanged += (sender, args) =>
            {
                SizeChanged();
            };
        }
예제 #38
0
 private void OnVisibilityChanged(CoreWindow sender, VisibilityChangedEventArgs args)
 {
     if (args.Visible == false)
         SystemNavigationManager.GetForCurrentView().BackRequested -= BackButtonPressed;
     else
     {
         SystemNavigationManager.GetForCurrentView().BackRequested += BackButtonPressed;
     }
 }
예제 #39
0
        private void Initialize()
        {
            liveResource = LiveResources.GetInstance();
            Windows.ApplicationModel.Core.CoreApplicationView mainView = Windows.ApplicationModel.Core.CoreApplication.MainView;
            Windows.UI.Core.CoreWindow cw = mainView.CoreWindow;
            UIDispatcher = cw.Dispatcher;

            AllAchievements = new ObservableCollection <Achievement>();
        }
예제 #40
0
 private void Canvas_KeyUp(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs e)
 {
     if (e.VirtualKey == Windows.System.VirtualKey.Left)
     {
     }
     else if (e.VirtualKey == Windows.System.VirtualKey.Right)
     {
     }
 }
예제 #41
0
        private void PlayerPage_KeyDown(CoreWindow sender, KeyEventArgs args)
        {
            args.Handled = true;
            switch (args.VirtualKey)
            {
                case Windows.System.VirtualKey.Space:
                    if (btn_Pause.Visibility == Visibility.Visible)
                    {
                        mediaElement.Pause();
                    }
                    else
                    {
                        mediaElement.Play();
                    }
                    break;
                case Windows.System.VirtualKey.Left:
                   // mediaElement.Position.Subtract(new TimeSpan(0, 0, 3));
                    slider3.Value = slider.Value - 3;
                    messShow.Show(mediaElement.Position.Hours.ToString("00") + ":" + mediaElement.Position.Minutes.ToString("00") + ":" + mediaElement.Position.Seconds.ToString("00"), 3000);
                    break;
                case Windows.System.VirtualKey.Up:
                    mediaElement.Volume += 0.1;
                    messShow.Show("音量:"+mediaElement.Volume.ToString("P"), 3000);
                    break;
                case Windows.System.VirtualKey.Right:
                    slider3.Value = slider.Value + 3;
                    messShow.Show(mediaElement.Position.Hours.ToString("00") + ":" + mediaElement.Position.Minutes.ToString("00") + ":" + mediaElement.Position.Seconds.ToString("00"), 3000);
                    break;
                case Windows.System.VirtualKey.Down:
                    mediaElement.Volume-= 0.1;
                    messShow.Show("音量:" + mediaElement.Volume.ToString("P"), 3000);
                    break;
                case Windows.System.VirtualKey.Escape:
                    if (btn_Full.Visibility==Visibility.Collapsed)
                    {
                        setting.SetSettingValue("Full", false);
                        btn_Full.Visibility = Visibility.Visible;
                        btn_ExitFull.Visibility = Visibility.Collapsed;
                        ApplicationView.GetForCurrentView().ExitFullScreenMode();
                    }
                    break;
                case Windows.System.VirtualKey.F11:
                    if (btn_ExitFull.Visibility== Visibility.Collapsed)
                    {
                        setting.SetSettingValue("Full", true);
                        btn_Full.Visibility = Visibility.Collapsed;
                        btn_ExitFull.Visibility = Visibility.Visible;
                        ApplicationView.GetForCurrentView().TryEnterFullScreenMode();
                    }
                    break;
                default:
                    break;
            }

         
        }
        // Instantiate views using "CreateForCurrentView"
        private ViewLifetimeControl(CoreWindow newWindow)
        {
            dispatcher = newWindow.Dispatcher;
            window = newWindow;
            viewId = ApplicationView.GetApplicationViewIdForWindow(window);

            // This class will automatically tell the view when its time to close
            // or stay alive in a few cases
            RegisterForEvents();
        }
예제 #43
0
        private void OnKeyUp(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs args)
        {
            var key = MapKey(args.VirtualKey);

            // ignore key presses that are not related to the keypad
            if (KeyPressed != null && key != KeyPadKey.Unknown)
            {
                KeyPressed(key);
            }
        }
예제 #44
0
        public static void Initialize()
        {
            _window = CoreWindow.GetForCurrentThread();
            _windowsBounds = _window.Bounds;
            _windowState = WindowState.Full;
            _window.SizeChanged += _window_SizeChanged;

            CoreApplication.Suspending += CoreApplication_Suspending;
            CoreApplication.Resuming += CoreApplication_Resuming;
        }
예제 #45
0
 private void MainPage_VisibilityChanged(CoreWindow sender, VisibilityChangedEventArgs args)
 {
     if (args.Visible == false)
     {
         //whenever we move away from the page, save data. 
         App.PageData = txtDataToBeSaved.Text;
         App.UseCloudStorage = chkSaveToCloud.IsChecked.Value;
         App.ExtendedExecution = chkEnableExtension.IsChecked.Value;
     }
 }
예제 #46
0
 private void CoreWindow_KeyUp(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs args)
 {
     switch (args.VirtualKey)
     {
     case VirtualKey.Space:
         keys[space] = false;
         break;
     }
     args.Handled = true; // tell the system we handled this event.
 }
예제 #47
0
 void CoreWindow_KeyUp(CoreWindow sender, KeyEventArgs e)
 {
     if (e.VirtualKey == Windows.System.VirtualKey.Left)
     {
         playerIsMovingLeft = false;
     } else if (e.VirtualKey == Windows.System.VirtualKey.Right)
     {
         playerIsMovingRight = false;
     }
 }
예제 #48
0
#pragma warning disable CC0057 // Unused parameters
        public static void OnKeyDown(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs args)
#pragma warning restore CC0057 // Unused parameters
        {
            //var logicalFocus = FocusManager.GetFocusedElement();
            //System.Diagnostics.Debug.WriteLine("=========== Windows.UI.Xaml.Input.FocusManager.FocusedElement=" + logicalFocus);
            //if (logicalFocus == this)
            //    System.Diagnostics.Debug.WriteLine("    THIS     ");

            args.Handled = ProcessVirualKey(HardwareKeyPage.FocusedElement ?? HardwareKeyPage.DefaultFocusedElement, args.VirtualKey);
        }
예제 #49
0
 private void OnVisibilityChanged(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.VisibilityChangedEventArgs args)
 {
     if (args.Visible && mRenderSurface != EGL.NO_SURFACE)
     {
         StartRenderLoop();
     }
     else
     {
         StopRenderLoop();
     }
 }
예제 #50
0
        private void CoreWindow_SizeChanged(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.WindowSizeChangedEventArgs args)
        {
            var appView = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView();

            if (!appView.IsFullScreen)
            {
                appView.TryEnterFullScreenMode();
                //appView.TryEnterViewModeAsync();
            }
            args.Handled = true;
        }
예제 #51
0
 private void CoreWindow_CharacterReceived(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.CharacterReceivedEventArgs args)
 {
     if (args.KeyCode == 27) //Escape
     {
         // your code here fore Escape key
     }
     if (args.KeyCode == 13) //Enter
     {
         // your code here fore Enter key
     }
 }
예제 #52
0
 void OnPointerReleased(CoreWindow sender, PointerEventArgs args)
 {
     try
     {
         gestureRecognizer.ProcessUpEvent(args.CurrentPoint);
     }
     catch (System.Exception e)
     {
         System.Diagnostics.Debug.WriteLine("Let's do yet another time warp.");
     }
 }
예제 #53
0
 private void Canvas_KeyDown(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs e)
 {
     if (e.VirtualKey == Windows.System.VirtualKey.Right)
     {
         Si.MoveShipLeft(false);
     }
     else if (e.VirtualKey == Windows.System.VirtualKey.Left)
     {
         Si.MoveShipRight(false);
     }
 }
예제 #54
0
        private void OnKeyUp(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs e)
        //private void OnKeyUp(object sender, KeyRoutedEventArgs e)
        {
            if (haveFocus == false)
            {
                return;
            }

            //var virtualKey = e.VirtualKey;

            //switch (e.KeyStatus.ScanCode)
            //{
            //    case 44: // W en français, Z en anglais, ..
            //        virtualKey = VirtualKey.W;
            //        break;
            //    case 45: // X en français, ? en anglais, ..
            //        virtualKey = VirtualKey.X;
            //        break;
            //}

            switch (e.VirtualKey)
            {
            case VirtualKey.Up:
                keyboardGamepad.Release(GamepadKeys.Up);
                break;

            case VirtualKey.Down:
                keyboardGamepad.Release(GamepadKeys.Down);
                break;

            case VirtualKey.Right:
                keyboardGamepad.Release(GamepadKeys.Right);
                break;

            case VirtualKey.Left:
                keyboardGamepad.Release(GamepadKeys.Left);
                break;

            // pour prendre en compte les clavier Qwerty/Azerty/Qwertz
            case VirtualKey.Z:
            case VirtualKey.W:
            case VirtualKey.Y:
                keyboardGamepad.Release(GamepadKeys.ButtonA);
                break;

            case VirtualKey.X:
                keyboardGamepad.Release(GamepadKeys.ButtonB);
                break;

            case VirtualKey.Space:
                keyboardGamepad.Release(GamepadKeys.ButtonStart);
                break;
            }
        }
예제 #55
0
 void OnPointerMoved(CoreWindow sender, PointerEventArgs args)
 {
     try
     {
         gestureRecognizer.ProcessMoveEvents(args.GetIntermediatePoints());
     }
     catch (System.Exception e)
     {
         System.Diagnostics.Debug.WriteLine("Lets do the time warp again.");
     }
 }
예제 #56
0
        private async void CoreWindow_Activated(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.WindowActivatedEventArgs args)
        {
            if (args.WindowActivationState == CoreWindowActivationState.PointerActivated)
            {
                var clipboard = await Services.Helpers.ClipboardHelper.CheckClipboard();

                if (clipboard != null)
                {
                    HohoemaNotificationService.ShowInAppNotification(clipboard.Type, clipboard.Id);
                }
            }
        }
        public void OnKeyDown(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs args)
        {
            var logicalFocus = FocusManager.GetFocusedElement();

            System.Diagnostics.Debug.WriteLine("=========== Windows.UI.Xaml.Input.FocusManager.FocusedElement=" + logicalFocus);
            if (logicalFocus == this)
            {
                System.Diagnostics.Debug.WriteLine("    THIS     ");
            }

            args.Handled = ProcessVirualKey(HardwareKeyPage.FocusedElement ?? HardwareKeyPage.DefaultFocusedElement, args.VirtualKey);
        }
예제 #58
0
        internal OpenGLESPage(OpenGLES openGLES)
        {
            mOpenGLES      = openGLES;
            mRenderSurface = EGL.NO_SURFACE;
            InitializeComponent();

            Windows.UI.Core.CoreWindow window = Windows.UI.Xaml.Window.Current.CoreWindow;

            window.VisibilityChanged += new TypedEventHandler <CoreWindow, VisibilityChangedEventArgs>((win, args) => OnVisibilityChanged(win, args));

            Loaded += (sender, args) => OnPageLoaded(sender, args);
        }
예제 #59
0
        private async void CoreWindow_Activated(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.WindowActivatedEventArgs args)
        {
            if (args.WindowActivationState == CoreWindowActivationState.PointerActivated)
            {
                NiconicoId?maybeId = await ClipboardHelper.CheckClipboard();

                if (maybeId is not null and NiconicoId id)
                {
                    HohoemaNotificationService.ShowInAppNotification(id);
                }
            }
        }
예제 #60
0
        private void CoreWindow_PointerPressed(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.PointerEventArgs args)
        {
            IsMousePressed = true;

            var x = args.CurrentPoint.Position.X - (sender.Bounds.Right - sender.Bounds.Left) / 2;
            var y = (sender.Bounds.Bottom - sender.Bounds.Top) / 2 - args.CurrentPoint.Position.Y;

            x /= scale;
            y /= scale;

            MousePoint = new Point(x, y);
            Sprite.SendPointerPressed(MousePoint);
        }