SimpleOrientationSensor sample

This sample shows how to use the Windows.Devices.Sensors.SimpleOrientationSensor API.

 
 
 
 
 
5 Star
(2)
10,631 times
Add to favorites
4/2/2014
E-mail Twitter del.icio.us Digg Facebook

Solution explorer

C++
C#
JavaScript
<!--
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
-->
<Page x:Class="Microsoft.Samples.Devices.Sensors.SimpleOrientationSensorSample.Scenario1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:Microsoft.Samples.Devices.Sensors.SimpleOrientationSensorSample" xmlns:common="using:SDKTemplate.Common" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">
  <Grid x:Name="LayoutRoot" HorizontalAlignment="Left" VerticalAlignment="Top">
    <StackPanel Orientation="Vertical">
      <TextBlock x:Name="InputTextBlock" TextWrapping="Wrap" Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Left" Text="Registers an event listener for orientation changes and displays the new orientation as it is reported."/>
      <StackPanel Orientation="Horizontal" Margin="0,10,0,0">
        <Button x:Name="ScenarioEnableButton" Content="Enable" Margin="0,0,10,0" Click="ScenarioEnable"/>
        <Button x:Name="ScenarioDisableButton" Content="Disable" Margin="0,0,10,0" Click="ScenarioDisable"/>
      </StackPanel>
      <Grid HorizontalAlignment="Left" VerticalAlignment="Top">
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="Auto"/>
          <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
          <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <TextBlock Grid.Row="0" Grid.Column="0" Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Right" Text="Orientation: "/>
        <TextBlock x:Name="ScenarioOutput_Orientation" Grid.Row="0" Grid.Column="1" Style="{StaticResource BasicTextStyle}" Margin="10,0,0,0" Text="No data"/>
      </Grid>
    </StackPanel>
  </Grid>
</Page>