Last active
August 29, 2015 14:19
-
-
Save mattleibow/2cef8c6c4d62bad26275 to your computer and use it in GitHub Desktop.
Microsoft Band SDK - Navigation Issues
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
// The code that shows the confirmation popup/page | |
public async Task<Boolean> GetAddTileConsentAsync(BandTile tile, CancellationToken token) | |
{ | |
Boolean flag; | |
CoreApplicationView mainView = CoreApplication.MainView; | |
if (mainView != null) | |
{ | |
CoreWindow coreWindow = mainView.CoreWindow; | |
if (coreWindow != null) | |
{ | |
TaskCompletionSource<Boolean> taskCompletionSource = null; | |
ConfiguredTaskAwaitable configuredTaskAwaitable = coreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { | |
token.ThrowIfCancellationRequested(); | |
Window current = Window.Current; | |
if (current != null) | |
{ | |
Frame content = current.Content as Frame; | |
if (content != null) | |
{ | |
taskCompletionSource = new TaskCompletionSource<Boolean>(); | |
content.Navigate(typeof(T), new AddTileViewModel(tile, taskCompletionSource)); | |
} | |
} | |
}).AsTask().ConfigureAwait(false); | |
await configuredTaskAwaitable; | |
if (taskCompletionSource != null) | |
{ | |
flag = await taskCompletionSource.get_Task().ConfigureAwait(false); | |
return flag; | |
} | |
} | |
} | |
flag = false; | |
return flag; | |
} | |
// the code that handles the user's response | |
if (base.Frame.CanGoBack) | |
{ | |
base.Frame.GoBack(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment