//Cortana Commands protected async override void OnNavigatedTo(NavigationEventArgs e) { Debug.Write("OnNavigated to"); _pageParameters = e.Parameter as VoiceCommandObjects.CortanaCommands; if (_pageParameters != null) { switch (_pageParameters.VoiceCommandName) { case "AddSong": var dialog = new ContentDialog1(); await dialog.ShowAsync(); break; case "OpenPlayList": MySplitView.IsPaneOpen = !MySplitView.IsPaneOpen; Search.Visibility = MySplitView.IsPaneOpen ? Visibility.Collapsed : Visibility.Visible; PlayListNames.Visibility = MySplitView.IsPaneOpen ? Visibility.Visible : Visibility.Collapsed; vm.DisplayAllPlaylists(); this.DataContext = vm; this.PlayListNames.ItemsSource = vm.playLists; if (vm.playLists.Count > 0) { MySplitView.IsPaneOpen = true; PlayListNames.Visibility = Visibility.Visible; } break; default: Debug.Write("Couldn't find command Name"); break; } } }
private async void AddSongButton_Click(object sender, RoutedEventArgs e) { var dialog = new ContentDialog1(); await dialog.ShowAsync(); vm.GetAllSongs(); }
private async void Init() { PushNotificationChannel channel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync(); channel.PushNotificationReceived += OnPushNotification; Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings; string Notification = (string)localSettings.Values["NotificationHub"]; string Connection = (string)localSettings.Values["ConnectionString"]; string Tag = (string)localSettings.Values["Tag"]; try { NotificationHub hub = new NotificationHub(Notification, Connection); //userTag[0] = tag; if (!String.IsNullOrWhiteSpace(Tag)) { string[] userTag = Tag.Split(";".ToCharArray()); var result = await hub.RegisterNativeAsync(channel.Uri, userTag); // // Displays the registration ID so you know it was successful if (result.RegistrationId != null) { } else { var dialog = new MessageDialog("Registration failed. Please check the configuration"); await dialog.ShowAsync(); } } else { Registration result = await hub.RegisterNativeAsync(channel.Uri, null); // // Displays the registration ID so you know it was successful if (result.RegistrationId != null) { //// txtResult.Text = ; //var dialog = new MessageDialog("Registration successful: " + result.RegistrationId); //await dialog.ShowAsync(); } else { var dialog = new MessageDialog("Registration failed. Please check the configuration"); await dialog.ShowAsync(); } } } catch (Exception Ex) { ContentDialog1 dialog = new ContentDialog1() { Title = "Configure connection", }; await dialog.ShowAsync(); } }
private async void ShowConf() { ContentDialog1 dialog = new ContentDialog1() { Title = "Configure connection", }; await dialog.ShowAsync(); }
private async void Button_Click(object sender, RoutedEventArgs e) { string a; string b; //Calls EC2 AWS SDK /* * Task<string> getMagicTask = MagicServiceUtility.GetServiceOutputAsync(); * * string result = await getMagicTask; * * Debug.WriteLine("Characters received: " +result + "\n"+result.Length); * if (result.Length > 0) * { * textBlock.Text = textBlock.Text + "\n" + result; * } */ TextBox accesskey = new TextBox(); accesskey.AcceptsReturn = false; accesskey.Height = 32; accesskey.PlaceholderText = "Enter Access Key"; TextBox secretkey = new TextBox(); secretkey.AcceptsReturn = false; secretkey.Height = 32; secretkey.PlaceholderText = "Enter Secret Key"; ContentDialog1 dialog = new ContentDialog1(); dialog.Title = "Credentials"; dialog.IsSecondaryButtonEnabled = true; dialog.PrimaryButtonText = "Run"; dialog.SecondaryButtonText = "Cancel"; if (await dialog.ShowAsync() == ContentDialogResult.Primary) { a = ((TextBox)dialog.FindName("AccessKey")).Text; b = ((TextBox)dialog.FindName("SecretKey")).Text; Task <string> createS3Buccket = new MagicUWP.ServiceUtilities(b, a).createS3(); string resultBucket = ""; resultBucket = await createS3Buccket; Debug.WriteLine("Characters received: " + resultBucket + "\n" + resultBucket.Length); if (resultBucket.Length > 0) { textBlock.Text = textBlock.Text + "\n" + resultBucket; } } /* * Task<string> createS3Buccket = new ServiceUtilities().createS3(); * * * string resultBucket = ""; * * resultBucket = await createS3Buccket; * * * Debug.WriteLine("Characters received: " + resultBucket + "\n" + resultBucket.Length); * if (resultBucket.Length > 0) * { * textBlock.Text = textBlock.Text + "\n" + resultBucket; * } * */ /* * Task<string> createEc2V = MagicServiceUtility.createEc2(); * string res = await createEc2V; * if (resultBucket.Length > 0) * { * * // textBlock.FontSize = 25; * // textBlock.Foreground = new SolidColorBrush(Windows.UI.Colors.Red); * textBlock.Text = "\n" + resultBucket; * * * * } */ }
private async void CurrentOnGeofenceStateChanged(GeofenceMonitor sender, object args) { var reports = sender.ReadReports(); await CoreApplication.MainView.Dispatcher.RunAsync(CoreDispatcherPriority.High, agileCallback : (async() => { foreach (GeofenceStateChangeReport report in reports) { switch (report.NewState) { case GeofenceState.Removed: break; case GeofenceState.Entered: Debug.WriteLine("entered"); foreach (MapElement mapElement in _map.MapElements) { if (mapElement is MapIcon) { MapIcon icon = (MapIcon)mapElement; if (icon.Title == report.Geofence.Id) { Sight s = mapElement.ReadData(); for (int i = CurrentRoute.Sights.IndexOf(s) + 1; i < CurrentRoute.Sights.Count; i++) { Sight sight = CurrentRoute.Sights[i]; if (sight.Name != "") { NextSight = sight; break; } } deleteRoutes(); redrawRoute(s.Position, NextSight.Position, true); ContentDialog1 dialog = new ContentDialog1(s); var result = await dialog.ShowAsync(); // primary button was clicked if (result == ContentDialogResult.Primary) { RedrawSight(icon); int geo = geofences.IndexOf(report.Geofence); geofences.RemoveAt(geo); page.Frame.Navigate(typeof(SightPage), s); break; } if (result == ContentDialogResult.None) { dialog.Hide(); } break; } } } break; case GeofenceState.Exited: Debug.WriteLine("kekekekekekekekekekkeke"); break; } } } )); }