상속: ISimpleOrientationSensor
예제 #1
0
 async private void orientationSensor_OrientationChanged(SimpleOrientationSensor sender, SimpleOrientationSensorOrientationChangedEventArgs args)
 {
     await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
     {
         ShowOrientationText(args.Orientation);
     });
 }
예제 #2
0
 private void OrientationChanged(SimpleOrientationSensor sender, SimpleOrientationSensorOrientationChangedEventArgs args)
 {
     if (_isStreaming)
     {
         var rotation = GetVideoRotation(args.Orientation);
         _mediaCapture.SetPreviewRotation(rotation);
     }
 }
예제 #3
0
        public static SimpleOrientationSensor GetDefault()
        {
            if (_instance == null)
            {
                _instance = new SimpleOrientationSensor();
            }

            return(_instance);
        }
예제 #4
0
 private async void OrientationSensor_OrientationChanged(SimpleOrientationSensor sender, SimpleOrientationSensorOrientationChangedEventArgs args)
 {
     // Keep previous orientation when the user puts its device faceup or facedown
     if ((args.Orientation != SimpleOrientation.Faceup) && (args.Orientation != SimpleOrientation.Facedown))
     {
         deviceOrientation = args.Orientation;
         await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => SetVideoOrientation());
     }
 }
예제 #5
0
        public Scenario2()
        {
            this.InitializeComponent();

            _sensor = SimpleOrientationSensor.GetDefault();
            if (_sensor == null)
            {
                rootPage.NotifyUser("No simple orientation sensor found", NotifyType.ErrorMessage);
            }
        }
예제 #6
0
        protected CodeViewModelBase()
        {
            if (!Windows.ApplicationModel.DesignMode.DesignModeEnabled)
            {
                _settings = Services.SettingsServices.SettingsService.Instance;
                _mediaCapture = new MediaCapture();
                CheckIfCamerasExistAsync();

                _simpleOrientationSensor = SimpleOrientationSensor.GetDefault();
            }
        }
예제 #7
0
        //Constructor for GameOver.xaml
        public GameOver()
        {
            this.InitializeComponent();
            copyDatabase();                                    //Copy the database so it can be found locally

            _simpleorientation = SimpleOrientationSensor.GetDefault();      //Get a default version of an orientation sensor.

            // Assign an event handler for the sensor orientation-changed event 
            if (_simpleorientation != null)
            {
                _simpleorientation.OrientationChanged += new TypedEventHandler<SimpleOrientationSensor, SimpleOrientationSensorOrientationChangedEventArgs>(OrientationChanged);
            } 
        }//end constructor
예제 #8
0
        public CameraPage()
        {
            this.InitializeComponent();
            Application.Current.Resuming += new EventHandler<object>(AppResume);
            HardwareButtons.BackPressed += HardwareButtons_BackPressed;
            HardwareButtons.CameraPressed += HardwareButtons_CameraPressed;
            HardwareButtons.CameraHalfPressed += HardwareButtons_CameraHalfPressed;
            HardwareButtons.CameraReleased += HardwareButtons_CameraHalfPressed;

            _simpleorientation = SimpleOrientationSensor.GetDefault();
            if (_simpleorientation != null) {
                _simpleorientation.OrientationChanged += new TypedEventHandler<SimpleOrientationSensor, SimpleOrientationSensorOrientationChangedEventArgs>(OrientationChanged);
            }
            
            //DisableNotificationsBar();
        }
        //Constructor for HighScores.xaml
        public HighScores()
        {
            this.InitializeComponent();
            copyDatabase();                                     //Copys the database file so it can be found locally in the application

            //Add event listener for the back hardware button
            HardwareButtons.BackPressed += HardwareButtons_BackPressed;

            _simpleorientation = SimpleOrientationSensor.GetDefault();      //Get a defualt version of an orientation sensor.

            // Assign an event handler for the sensor orientation-changed event 
            if (_simpleorientation != null)
            {
                _simpleorientation.OrientationChanged += new TypedEventHandler<SimpleOrientationSensor, SimpleOrientationSensorOrientationChangedEventArgs>(OrientationChanged);
            } 
        }//end of constructor
        //Constructor
        public HighScoresMenu()
        {
            this.InitializeComponent();
            createGameOptionList();                                         //Populate list with high score menu options
            highscoreOptionsList.ItemsSource = highscoreOptions;            //Make list of GameTypes the item source for the list

            //Add event listener for the back hardware button
            HardwareButtons.BackPressed += HardwareButtons_BackPressed;

            _simpleorientation = SimpleOrientationSensor.GetDefault();      //Get a defualt version of an orientation sensor.

            // Assign an event handler for the sensor orientation-changed event 
            if (_simpleorientation != null)
            {
                _simpleorientation.OrientationChanged += new TypedEventHandler<SimpleOrientationSensor, SimpleOrientationSensorOrientationChangedEventArgs>(OrientationChanged);
            } 
        }//end HighScoresMenu constructor
예제 #11
0
        //Constructor
        public MainPage()
        {
            this.InitializeComponent();
            createGameOptionList();                                 //Populate the list of GameTypes.
            gameOptionsList.ItemsSource = gameOptions;              //Pass the GameType list as the listboxes item source

            //Add event listener for the back hardware button
            HardwareButtons.BackPressed += HardwareButtons_BackPressed;

            _simpleorientation = SimpleOrientationSensor.GetDefault();      //Get a defualt version of an orientation sensor.

            // Assign an event handler for the sensor orientation-changed event 
            if (_simpleorientation != null)
            {
                _simpleorientation.OrientationChanged += new TypedEventHandler<SimpleOrientationSensor, SimpleOrientationSensorOrientationChangedEventArgs>(OrientationChanged);
            } 

            //this.NavigationCacheMode = NavigationCacheMode.Required;
        }//end MainPage() constructor
 async void MainPage_OrientationChanged( SimpleOrientationSensor sender, SimpleOrientationSensorOrientationChangedEventArgs args )
 {
     await Dispatcher.RunAsync( CoreDispatcherPriority.Normal, () =>
     {
         TextSimpleOrientation.Text = "SimpleOrientation : " +  args.Orientation.ToString();
     } );
 }
 public SimpleOrientationSensorEvents(SimpleOrientationSensor This)
 {
     this.This = This;
 }
예제 #14
0
        private void OrientationChange(SimpleOrientationSensor sender, SimpleOrientationSensorOrientationChangedEventArgs args)
        {

            Settings.orientation = this.orientationSensor.GetCurrentOrientation();
            switch (Settings.orientation)
            {
                case SimpleOrientation.NotRotated: Settings.or = 1; break;
                //case SimpleOrientation.Faceup: Settings.or = 0; break;
                case SimpleOrientation.Rotated180DegreesCounterclockwise: Settings.or = 2; break;
                case SimpleOrientation.Rotated270DegreesCounterclockwise: Settings.or = 3; break;
                case SimpleOrientation.Rotated90DegreesCounterclockwise: Settings.or = 4; break;
            } 
            
        }
 private void SimpleOrientationSensor_OrientationChanged(SimpleOrientationSensor sender, SimpleOrientationSensorOrientationChangedEventArgs args)
 {
     if (args.Orientation != SimpleOrientation.Faceup && args.Orientation != SimpleOrientation.Facedown)
     {
         // Only raise the OrientationChanged event if the device is not parallel to the ground. This allows users to take pictures of documents (FaceUp)
         // or the ceiling (FaceDown) in portrait or landscape, by first holding the device in the desired orientation, and then pointing the camera
         // either up or down, at the desired subject.
         //Note: This assumes that the camera is either facing the same way as the screen, or the opposite way. For devices with cameras mounted
         //      on other panels, this logic should be adjusted.
         OrientationChanged?.Invoke(this, false);
     }
 }
예제 #16
0
 private void OrientationSensor_OrientationChanged(SimpleOrientationSensor sender, SimpleOrientationSensorOrientationChangedEventArgs args)
 {
     if (args.Orientation != SimpleOrientation.Faceup && args.Orientation != SimpleOrientation.Facedown)
     {
         // Only update the current orientation if the device is not parallel to the ground. This allows users to take pictures of documents (FaceUp)    
         deviceOrientation = args.Orientation;
     }
 }
예제 #17
0
        public MapControl()
        {
            _renderTarget = new Canvas
                {
                    VerticalAlignment = VerticalAlignment.Stretch,
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    Background = new SolidColorBrush(Colors.Transparent),
                };
            Children.Add(_renderTarget);

            _bboxRect = new Rectangle
                {
                    Fill = new SolidColorBrush(Colors.Red),
                    Stroke = new SolidColorBrush(Colors.Black),
                    StrokeThickness = 3,
                    RadiusX = 0.5,
                    RadiusY = 0.5,
                    StrokeDashArray = new DoubleCollection { 3.0 },
                    Opacity = 0.3,
                    VerticalAlignment = VerticalAlignment.Top,
                    HorizontalAlignment = HorizontalAlignment.Left,
                    Visibility = Visibility.Collapsed
                };
            Children.Add(_bboxRect);
            
            Map = new Map();
            Loaded += MapControlLoaded;

            SizeChanged += MapControlSizeChanged;
            CompositionTarget.Rendering += CompositionTarget_Rendering;
            _renderer = new MapRenderer(_renderTarget);
            PointerWheelChanged += MapControl_PointerWheelChanged;
            
            ManipulationMode = ManipulationModes.Scale | ManipulationModes.TranslateX | ManipulationModes.TranslateY;     
            ManipulationDelta += OnManipulationDelta;
            ManipulationCompleted += OnManipulationCompleted;
            ManipulationInertiaStarting += OnManipulationInertiaStarting;

            _orientationSensor = SimpleOrientationSensor.GetDefault();
            if (_orientationSensor != null)
            {
                _orientationSensor.OrientationChanged += (sender, args) =>
                    Dispatcher.RunAsync(CoreDispatcherPriority.Normal, Refresh);
            }
        }
 private void OrientationSensor_OrientationChanged(SimpleOrientationSensor sender, SimpleOrientationSensorOrientationChangedEventArgs args)
 {
     if (args.Orientation != SimpleOrientation.Faceup && args.Orientation != SimpleOrientation.Facedown)
     {
         _deviceOrientation = args.Orientation;
     }
 }
예제 #19
0
 public MainPage()
 {
     this.InitializeComponent();
     orientationSensor = SimpleOrientationSensor.GetDefault();
 }
 void OnOrientationSensorOrientationChanged(SimpleOrientationSensor sender, SimpleOrientationSensorOrientationChangedEventArgs args)
 {
     // Only update orientatino if the device is not parallel to the ground
     if (args.Orientation != SimpleOrientation.Faceup && args.Orientation != SimpleOrientation.Facedown)
     {
         deviceOrientation = args.Orientation;
     }
 }
예제 #21
0
파일: Game1.cs 프로젝트: mattsains/PoVtris
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            OrientationSensor = OrientationSensor.GetDefault();
            if (OrientationSensor == null)
            {
                SimpleOrientationSensor = SimpleOrientationSensor.GetDefault();
                if (SimpleOrientationSensor == null)
                    throw new Exception("No way of determining orientation");
            }

            TouchPanel.EnabledGestures = GestureType.Hold | GestureType.Flick | GestureType.HorizontalDrag | GestureType.VerticalDrag | GestureType.DragComplete;

            vertexBuffer = new DynamicVertexBuffer(graphics.GraphicsDevice, typeof(VertexPositionColor), 8, BufferUsage.WriteOnly);
            indexBuffer = new DynamicIndexBuffer(graphics.GraphicsDevice, typeof(ushort), 36, BufferUsage.WriteOnly);

            basicEffect = new BasicEffect(graphics.GraphicsDevice); //(device, null);
            basicEffect.LightingEnabled = false;
            basicEffect.VertexColorEnabled = true;
            basicEffect.TextureEnabled = false;

            DepthStencilState depthBufferState = new DepthStencilState();
            depthBufferState.DepthBufferEnable = true;
            GraphicsDevice.DepthStencilState = depthBufferState;

            TetrisState.Initialize(graphics.GraphicsDevice);

            Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().SuppressSystemOverlays = true;
            graphics.SupportedOrientations = DisplayOrientation.Portrait;

            base.Initialize();
        }
        /// <summary>
        /// Occurs each time the simple orientation sensor reports a new sensor reading.
        /// </summary>
        /// <param name="sender">The event source.</param>
        /// <param name="args">The event data.</param>
        private async void OrientationSensor_OrientationChanged(SimpleOrientationSensor sender, SimpleOrientationSensorOrientationChangedEventArgs args)
        {
            if (args.Orientation != SimpleOrientation.Faceup && args.Orientation != SimpleOrientation.Facedown)
            {
                // Only update the current orientation if the device is not parallel to the ground. This allows users to take pictures of documents (FaceUp)
                // or the ceiling (FaceDown) in portrait or landscape, by first holding the device in the desired orientation, and then pointing the camera
                // either up or down, at the desired subject.
                //Note: This assumes that the camera is either facing the same way as the screen, or the opposite way. For devices with cameras mounted
                //      on other panels, this logic should be adjusted.
                _deviceOrientation = args.Orientation;

                await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => UpdateButtonOrientation());
            }
        }
예제 #23
0
        /// <summary>
        /// Event handler for orientation sensor changes.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        private void OrientationSensor_OrientationChanged(SimpleOrientationSensor sender, SimpleOrientationSensorOrientationChangedEventArgs args)
        {
            if (args.Orientation != SimpleOrientation.Faceup && args.Orientation != SimpleOrientation.Facedown)
            {
                _deviceOrientation = args.Orientation;
            }

            // Update the UI button orientation
            UpdateButtonOrientation();
        }