Last active
December 31, 2015 12:59
-
-
Save tiagobbraga/7989512 to your computer and use it in GitHub Desktop.
Tela de espera para aplicativos Surface(PixelSense)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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