private async void Page_Loaded(object sender, RoutedEventArgs e) { if (!initialized) { initialized = true; var hostnames = await HostNameProvider.GetConnectedHostsAsync(); if (hostnames.Count == 0) { MessageDialog dialog = new MessageDialog( "Network is not available. Please connect to a network and then restart the appplication."); dialog.Commands.Add(new UICommand("Exit application", new UICommandInvokedHandler((c) => { Application.Current.Exit(); }))); await dialog.ShowAsync(); } await client.ActivateAsyncPhone(); } }