How can I prevent my .NET Wearable app from going to sleep

Just to summarize, it works now. When user looks on the watch, the app is moved to foreground. It’s always activated.

Previously I had some logic in App.OnResume, and it seems this method was sometimes called before the Display.StateChanged and sometimes after. This is all what we need, in App.xaml.cs constructor:

Display.StateChanged += Display_StateChanged;

Then add this method:

private void Display_StateChanged(object sender, DisplayStateChangedEventArgs e)
{
    if (e.State == DisplayState.Normal && _lastDisplayState == DisplayState.Off)
        SendLaunchRequest();

    _lastDisplayState = e.State;
}

And implement the SendLaunchRequest method:

private void SendLaunchRequest()
{
    try
    {
        AppControl.SendLaunchRequest(
            new AppControl
            {
                ApplicationId = Constants.AppID,
                LaunchMode = AppControlLaunchMode.Single,
            }, (launchRequest, replyRequest, result) => { });
    }
    catch (LaunchRejectedException) { Logger.Log("Launch rejected"); }
    catch (Exception ex) { Logger.Log(ex); }
}