Logo
programming4us
programming4us
programming4us
programming4us
Home
programming4us
XP
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Windows Phone
 
Windows Phone

Windows Phone 8 : Developing for the Phone - The Phone Experience (part 4) - Understanding Idle Detection, The Tilt Effect

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
6/16/2013 5:23:56 PM

5. Understanding Idle Detection

The Windows Phone operating system automatically detects when a user has stopped using the phone and locks it. The phone will go to a lock screen, which can either display a pass code to open the lock screen or just instruct the user to slide up the wallpaper screen to get back to the phone.

Sometimes when you’re building certain types of applications, you want your application to continue to run regardless of whether the phone has input. There are two types of idle detection modes: application and user.

The easier of these to understand is the user idle detection mode. On the PhoneApplicationService class is a property called UserIdleDetectionMode; it is enabled by default. This means that if no touch events are detected, it will let the phone go to the lock screen. You can change this behavior (to enable your application to continue to run as the main running application even if the user isn’t interacting with your application) by disabling this detection mode, like so:

// Allow application to stay in the foreground
// even if the user isn't interacting with the application
PhoneApplicationService.Current.UserIdleDetectionMode =
  IdleDetectionMode.Disabled;

Disabling the user idle detection mode is useful when you are doing things that engage the user but do not require input (for example, showing a video, displaying a clock, and so on).

In contrast, the application idle detection mode is not about preventing the lock screen but determining what the application should do when the lock screen is enabled. By default, the application idle detection mode is enabled, which means that when the lock screen appears the application is paused (as though it was being tombstoned). By disabling the application idle detection mode, you allow your application to continue to run under the lock screen. To disable the application idle detection mode, you also use the PhoneApplicationService class:

// Allow your application to continue to run
// when the lock screen is shown
PhoneApplicationService.Current.ApplicationIdleDetectionMode =
  IdleDetectionMode.Disabled;

6. The Tilt Effect

In many places on the phone, a subtle but effective feedback mechanism is employed when selecting items in a list or other controls. This is called the tilt effect. In Figure 5, you can see that the second item in the list is not being interacted with via touch; however, in Figure 6 you can see that the second item is subtly tilted to give the user feedback that she is touching the item. In fact, it’s hard to see here in static images, but the tilt actually interacts with where the user is touching the item.

Image

FIGURE 5 Untilted

Image

FIGURE 6 Tilted

Unfortunately, this effect is not built into the framework, but it is available in the Windows Phone Toolkit. When you include the Toolkit’s XML namespace declaration in your XAML file, you can specify it at any level to enable or disable this behavior. The namespace required is the same one that is used to include Windows Phone Toolkit controls . Typically you would include it at the page level to support the tilt effect in all controls, like so:

<phone:PhoneApplicationPage ...
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;
                   assembly=Microsoft.Phone.Controls.Toolkit"
    toolkit:TiltEffect.IsTiltEnabled="True">

The TiltEffect.IsTiltEnabled property can be applied to any individual control as well if you want to apply the effect to specific controls instead of at the page or container levels. The other attached property is TiltEffect.SuppressTilt. This attached property enables you to turn off the tilt effect on particular controls where the TiltEffect.IsTiltEnabled attached property is enabled at a higher level. For example:

<Grid x:Name="ContentPanel"
      Grid.Row="1"
      Margin="12,0,12,0"
      toolkit:TiltEffect.IsTiltEnabled="False">
  <ListBox FontSize="28"
            Name="listBox1"
            toolkit:TiltEffect.SuppressTilt="True"
            ItemsSource="{Binding}" />
</Grid>

Because these are attached properties, you can set them in code as well:

using Microsoft.Phone.Controls;

public partial class MainPage : PhoneApplicationPage
{
  // Constructor
  public MainPage()
  {
    InitializeComponent();

    listBox1.SetValue(TiltEffect.SuppressTiltProperty, false);
  }
}

Other -----------------
- Windows Phone 8 : Developing for the Phone - Application Lifecycle (part 3) - Tombstoning
- Windows Phone 8 : Developing for the Phone - Application Lifecycle (part 2) - Navigation
- Windows Phone 8 : Developing for the Phone - Application Lifecycle (part 1)
- Windows Phone 8 : Designing for the Phone - Implementing the Look and Feel of the Phone
- Windows Phone 8 : Designing for the Phone - Designing with Visual Studio
- Windows Phone 7 : 3D Game Development (part 4) - Rendering 3D Models
- Windows Phone 7 : 3D Game Development (part 3) - The Game Class
- Windows Phone 7 : 3D Game Development (part 2) - Rendering 3D Primitives
- Windows Phone 7 : 3D Game Development (part 1) - 3D Game Concepts
- Windows Phone 8 : Phone-Specific Design (part 3) - Using the Pivot Control in Blend
 
 
Top 10
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
 
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server