Skip to content

Instantly share code, notes, and snippets.

@tiagobbraga
Last active December 31, 2015 12:59
Show Gist options
  • Save tiagobbraga/7989512 to your computer and use it in GitHub Desktop.
Save tiagobbraga/7989512 to your computer and use it in GitHub Desktop.
Tela de espera para aplicativos Surface(PixelSense)
#region Properties of Class
private readonly DispatcherTimer _activityTimer;
private readonly double minutesInactivity = 3; // 3 minutes
#endregion
#region Inside of Method Constructor or of another local
InputManager.Current.PreProcessInput += OnActivity;
_activityTimer = new DispatcherTimer { Interval = TimeSpan.FromMinutes(minutesInactivity), IsEnabled = true };
_activityTimer.Tick += OnInactivity;
#endregion
#region Inactivity Time
void OnInactivity(object sender, EventArgs e)
{
// can be call standby mode
}
void OnActivity(object sender, PreProcessInputEventArgs e)
{
InputEventArgs inputEventArgs = e.StagingItem.Input;
if (inputEventArgs is TouchEventArgs)
{
// can be call normal mode
_activityTimer.Stop();
_activityTimer.Start();
}
}
#endregion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment