private async void TeamOneName() { TextBox txtName = new TextBox(); Grid contentGrid = new Grid(); contentGrid.Children.Add(txtName); ContentDialog nameDialog = new ContentDialog() { Title = "Enter Team One Name", Content = contentGrid, PrimaryButtonText = "Submit" }; await nameDialog.ShowAsync(); if (txtName.Text!="") { team1Name= txtName.Text; } else { team1Name = "Team One"; } teamOneName.Text = team1Name; }
private async void buttonConnect_Click(object sender, RoutedEventArgs e) { if (!App.serialPort.IsConnected()) { int selection = listbox1.SelectedIndex; if (selection < 0) return; await App.serialPort.Connect(selection); if (!App.serialPort.IsConnected()) { ContentDialog dialog = new ContentDialog(); dialog.Title = "Connection failed"; dialog.Content = "Try to select another device"; dialog.PrimaryButtonText = "OK"; await dialog.ShowAsync(); return; } App.ledStripController.Connect(); Frame.Navigate(typeof(ControlPage)); } else { App.ledStripController.Disconnect(); App.serialPort.Disconnect(); } // RefrashInterface(); }
private void CancelButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { #if DEBUG System.Diagnostics.Debug.WriteLine("CancelButton"); #endif Application.Current.Exit(); }
private async void Error(string title) { ContentDialog dialogo = new ContentDialog(); dialogo.PrimaryButtonText = "Ок"; dialogo.Title = title; await dialogo.ShowAsync(); }
private void ContentDialog_SecondaryButtonClick( ContentDialog sender, ContentDialogButtonClickEventArgs args ) { if ( Member.WillLogin || Member.IsLoggedIn ) { args.Cancel = true; } }
public static async void ShowContentDialog(string dialogTitle, string dialogMessage) { var dialog = new ContentDialog() { Title = string.IsNullOrEmpty(dialogTitle) ? "Storage Demo Client" : dialogTitle }; // Setup Content var panel = new StackPanel(); panel.Children.Add(new TextBlock { Text = dialogMessage, TextWrapping = TextWrapping.Wrap, }); dialog.Content = panel; // Add Buttons dialog.PrimaryButtonText = "Close"; dialog.IsPrimaryButtonEnabled = false; // Show Dialog var result = await dialog.ShowAsync(); }
} // end void private async void StartRecognizing_Click(object sender, RoutedEventArgs e) { // Create an instance of SpeechRecognizer. var speechRecognizer = new Windows.Media.SpeechRecognition.SpeechRecognizer(); // Compile the dictation grammar by default. await speechRecognizer.CompileConstraintsAsync(); // Start recognition. Windows.Media.SpeechRecognition.SpeechRecognitionResult speechRecognitionResult = await speechRecognizer.RecognizeWithUIAsync(); ContentDialog notifyDelete = new ContentDialog() { Title = "Confirm delete?", Content = speechRecognitionResult.Text, PrimaryButtonText = "Save Note", SecondaryButtonText = "Cancel" }; ContentDialogResult result = await notifyDelete.ShowAsync(); if (result == ContentDialogResult.Primary) { tbNote.Text = speechRecognitionResult.Text; } else { // User pressed Cancel or the back arrow. // Terms of use were not accepted. } // Do something with the recognition result. //var messageDialog = new Windows.UI.Popups.MessageDialog(speechRecognitionResult.Text, "Text spoken"); //await messageDialog.ShowAsync(); } // end StartRecognizing_Click
private void HandleContentDialogPrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { if ((deleteSong.IsChecked.HasValue && deleteSong.IsChecked.Value) && (deleteSongConfirm.IsChecked.HasValue && deleteSongConfirm.IsChecked.Value)) { LibraryViewModel.Current.DeleteSong(Song); } else { Song.Name = editSongName.Text; Song.ArtistName = editArtistName.Text; string newAlbumName = editAlbumName.Text; string newAlbumAristName = editAlbumAritstName.Text; if (newAlbumName != Song.Album.Name || newAlbumAristName != Song.Album.ArtistName) { ArtistViewModel albumArtistViewModel = LibraryViewModel.Current.LookupArtistByName(newAlbumAristName); AlbumViewModel newAlbumViewModel = LibraryViewModel.Current.LookupAlbumByName(newAlbumName, albumArtistViewModel.ArtistId); Song.UpdateAlbum(newAlbumViewModel); } uint newTrackNumber; if (uint.TryParse(editTrackNumber.Text, out newTrackNumber)) { Song.TrackNumber = newTrackNumber; } } }
private void ContentDialog_PrimaryButtonClick( ContentDialog sender, ContentDialogButtonClickEventArgs args ) { args.Cancel = true; if ( Keys.SelectedItem == null ) { StringResources stx = new StringResources(); ServerMessage.Text = "Please Select a key"; return; } string PubKey = RSA.SelectedItem.GenPublicKey(); string Remarks = RemarksInput.Text.Trim(); if ( string.IsNullOrEmpty( Remarks ) ) { Remarks = RemarksPlaceholder; } RCache.POST( Shared.ShRequest.Server , Shared.ShRequest.PlaceRequest( Target, PubKey, BindItem.Id, Remarks ) , PlaceSuccess , ( c, Id, ex ) => { Error( ex.Message ); } , false ); }
private void DeleteItemClicked(ContentDialog sender, ContentDialogButtonClickEventArgs args) { if (DeleteTodoItemClicked != null) { DeleteTodoItemClicked(this, (TodoItemViewModel)this.DataContext); } }
//Sign in button private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { // Ensure the user name and password fields aren't empty. If a required field // is empty, set args.Cancel = true to keep the dialog open. if (string.IsNullOrEmpty(userNameTextBox.Text)) { args.Cancel = true; errorTextBlock.Text = "User name is required."; } else if (string.IsNullOrEmpty(passwordTextBox.Password)) { args.Cancel = true; errorTextBlock.Text = "Password is required."; } // If you're performing async operations in the button click handler, // get a deferral before you await the operation. Then, complete the // deferral when the async operation is complete. ContentDialogButtonClickDeferral deferral = args.GetDeferral(); //if (await SomeAsyncSignInOperation()) //{ this.Result = SignInResult.SignInOK; //} //else //{ // this.Result = SignInResult.SignInFail; //} deferral.Complete(); }
private async void buttonAddPerson_Click(object sender, RoutedEventArgs e) { var dialog = new ContentDialog(); dialog.Title = "Add a person to your list"; dialog.Content = new TextBox(); dialog.PrimaryButtonText = "Add"; dialog.IsPrimaryButtonEnabled = true; var result = await dialog.ShowAsync(); if (ContentDialogResult.Primary == result) { try { var textBox = (TextBox)dialog.Content; string text = textBox.Text; if (text != "") { Person person = new Person(text); ListViewItem item = new ListViewItem { Content = person.Name, Tag = person }; listViewPerson.Items.Add(item); person.Save(); } } catch (NullReferenceException) { } } }
private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { if(Windows.Storage.ApplicationData.Current.LocalSettings.Values.Any(m => m.Key.Equals("username"))) Windows.Storage.ApplicationData.Current.LocalSettings.Values.Remove("username"); Windows.Storage.ApplicationData.Current.LocalSettings.Values.Add(new KeyValuePair<string, object>("username", this.name.Text)); this.Username = this.name.Text; }
private async void button_Click(object sender, RoutedEventArgs e) { if (MapControl1.IsStreetsideSupported) { BasicGeoposition cityPosition = new BasicGeoposition() { Latitude = 48.858, Longitude = 2.295 }; Geopoint cityCenter = new Geopoint(cityPosition); StreetsidePanorama panoramaNearCity = await StreetsidePanorama.FindNearbyAsync(cityCenter); if (panoramaNearCity != null) { StreetsideExperience ssView = new StreetsideExperience(panoramaNearCity); ssView.OverviewMapVisible = true; MapControl1.CustomExperience = ssView; } } else { ContentDialog viewNotSupportedDialog = new ContentDialog() { Title = "Streetside is not supported", Content = "\nStreetside views are not supported on this device.", PrimaryButtonText = "OK" }; await viewNotSupportedDialog.ShowAsync(); } }
private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { Dokument.statusBean = (Model.Status)statusi.SelectedItem; Dokument.vrstaDokumenta = (Model.VrstaDokumenta)vrsteDokumenata.SelectedItem; Dokument.kreiran = DateTime.Now; Dokument.istice = istice.Date.Date; }
private void OnDialogClosing(ContentDialog sender, ContentDialogClosingEventArgs args) { bool isChecked = true; if (username.Text == "") { msg.Text = "请输入用户名。"; isChecked = false; } if (pwd.Password == "" || pwd2.Password == "") { msg.Text = "请输入密码。"; isChecked = false; } if (pwd.Password != pwd2.Password) { msg.Text = "两次输入的密码不一致。"; isChecked = false; } if(args.Result == ContentDialogResult.Primary) { args.Cancel = !isChecked; } }
private void OnDialogOpened(ContentDialog sender, ContentDialogOpenedEventArgs args) { username.ClearValue(TextBox.TextProperty); pwd.ClearValue(PasswordBox.PasswordProperty); pwd2.ClearValue(PasswordBox.PasswordProperty); msg.ClearValue(TextBlock.TextProperty); }
private async void button_Click(object sender, RoutedEventArgs e) { var dialog = new ContentDialog(); dialog.Title = "Add a gift to your list"; dialog.Content = new TextBox(); dialog.PrimaryButtonText = "Add"; dialog.IsPrimaryButtonEnabled = true; var result = await dialog.ShowAsync(); if (ContentDialogResult.Primary == result) { try { var textBox = (TextBox)dialog.Content; string text = textBox.Text; if (text != "") { listViewGifts.Items.Add(text); _currentPerson.Gifts.Add(text); _currentPerson.TransformListToString(); _currentPerson.Save(); } } catch (NullReferenceException) { } } }
private async void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { // Disable the primary button IsPrimaryButtonEnabled = false; // Force the dialog to stay open until the operation completes. // We will call Hide() when the api calls are done. args.Cancel = true; try { // Change the passphrase await KryptPadApi.ChangePassphraseAsync(OldPassphrase, NewPassphrase); // Done await DialogHelper.ShowMessageDialogAsync("Profile passphrase changed successfully."); // Hide dialog Hide(); } catch (WarningException ex) { // Operation failed await DialogHelper.ShowMessageDialogAsync(ex.Message); } catch (WebException ex) { // Operation failed await DialogHelper.ShowMessageDialogAsync(ex.Message); } // Restore the button IsPrimaryButtonEnabled = CanChangePassphrase; }
private async void OnTakeScreenshotButtonClicked(object sender, RoutedEventArgs e) { // Export the image from mapview and assign it to the imageview var exportedImage = await Esri.ArcGISRuntime.UI.RuntimeImageExtensions.ToImageSourceAsync(await MyMapView.ExportImageAsync()); // Create dialog that is used to show the picture var dialog = new ContentDialog() { Title = "Screenshot", MaxWidth = ActualWidth, MaxHeight = ActualHeight }; // Create Image var imageView = new Image() { Source = exportedImage, Margin = new Thickness(10), Stretch = Stretch.Uniform }; // Set image as a content dialog.Content = imageView; // Show dialog as a full screen overlay. await dialog.ShowAsync(); }
void DevicePickerDialog_Closed(ContentDialog sender, ContentDialogClosedEventArgs args) { if (SelectedDevice == null) { _owner.OnDevicePickerDismissed(); } }
public async void ShowNoAccessDialog() { AccessStatus = await RequestAccess(); if (AccessStatus == GeolocationAccessStatus.Allowed) { return; } TextBlock content = new TextBlock { Text = "ERROR_NO_LOCTION_ACCESS_DisplayMessage".t(R.File.CORTANA), TextAlignment = Windows.UI.Xaml.TextAlignment.Center, Margin = new Windows.UI.Xaml.Thickness { Bottom = 10, Left = 10, Top = 10, Right = 10}, TextWrapping = Windows.UI.Xaml.TextWrapping.WrapWholeWords, HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center, VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center, }; ContentDialog dialog = new ContentDialog() { Content = content }; dialog.SecondaryButtonText = "DIALOG_NO_LOCATION_ACCESS_CANCEL".t(); dialog.PrimaryButtonText = "DIALOG_NO_LOCATION_ACCESS_SETTINGS_BUTTON_TEXT".t(); dialog.PrimaryButtonClick += (d, _) => { ShowLocationSettingsPage().Forget(); }; await dialog.ShowAsync(); }
private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { try { selection = int.Parse(number.Text); if (selection > 0 && selection <= MainPage.newestComic) canClose = true; else throw new OverflowException(); } catch (ArgumentNullException) { errorText.Text = "Please enter a number between 1 and " + MainPage.newestComic; canClose = false; } catch (FormatException) { errorText.Text = "Please enter a number between 1 and " + MainPage.newestComic; canClose = false; } catch (OverflowException) { errorText.Text = "Please enter a number between 1 and " + MainPage.newestComic; canClose = false; } }
private async void showDialog() { dialog = new ContentDialog() { Title = "Authenticeren met de Hue Bridge", MaxWidth = this.ActualWidth, Background = new SolidColorBrush(Color.FromArgb(0xff, 0xff, 0xff, 0xff)) }; var panel = new StackPanel(); panel.Children.Add(new TextBlock { Text = "Druk op de link knop op uw Hue bridge om verbinding te maken.", TextWrapping = TextWrapping.Wrap }); BitmapImage bitmapImage = new BitmapImage(new Uri("ms-appx:///Assets/smartbridge.jpg")); panel.Children.Add(new Image { Source = bitmapImage }); dialog.Content = panel; var result = await dialog.ShowAsync(); }
/// <summary> /// 确定 /// </summary> /// <param name="sender"></param> /// <param name="args"></param> private async void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { args.Cancel = true; UpLoading.Visibility = Visibility.Visible; IsPrimaryButtonEnabled = false; object[] result = await UserService.AddWZ(WZUrl.Text, WZTitle.Text, WZTags.Text, WZSummary.Text); if (result != null) { if ((bool)result[0]) { Hide(); } else { Tips.Text = result[1].ToString(); UpLoading.Visibility = Visibility.Collapsed; IsPrimaryButtonEnabled = true; } } else { Tips.Text = "操作失败!"; UpLoading.Visibility = Visibility.Collapsed; IsPrimaryButtonEnabled = true; } }
private async static void Tela_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { var tela = sender.Content as MyUserControl1; var readDataa = await ReadWrite.readStringFromLocalFile("data"); Profile profile = JsonSerilizer.ToProfile(readDataa); if (tela.passwordBoxSenha.Password == profile.Password) { } else { var acessar = new MyUserControl1(); ContentDialog dialogo = new ContentDialog(); dialogo.PrimaryButtonText = "Войти"; dialogo.PrimaryButtonClick += Tela_PrimaryButtonClick; dialogo.Content = acessar; await dialogo.ShowAsync(); } }
async Task CallWebApiAsync() { HttpClient client = new HttpClient(); HttpResponseMessage response = await client.GetAsync("http://forecastlabo2.azurewebsites.net/api/Forecast"); if (response.StatusCode == System.Net.HttpStatusCode.OK) { string json = await response.Content.ReadAsStringAsync(); var forecasts = Newtonsoft.Json.JsonConvert.DeserializeObject<Forecasts[]>(json); ForeCastListView.ItemsSource = forecasts; }else { var dialog = new ContentDialog() { Title = "Ooooops", MaxWidth = this.ActualWidth }; var panel = new StackPanel(); panel.Children.Add(new TextBlock { Text = "Une erreur s'est produite lors de la récupération des prévisions météo", TextWrapping = TextWrapping.Wrap, }); dialog.Content = panel; await dialog.ShowAsync(); //try catch et appeler une méthode qui gère l'erreur //recherche google mot clé UWP / WPF Universal App/ faire les recherches en anglais } }
private void ContentDialog_PrimaryButtonClick( ContentDialog sender, ContentDialogButtonClickEventArgs args ) { args.Cancel = true; DetectInputLogin(); Canceled = false; }
protected void CancelPreviousAndShowDialog(ContentDialog dialog) { if (previous == null) previous = dialog; CancelPreviousDialog(); LastDialogControl = dialog.ShowAsync(); }
void SignInContentDialog_Closing(ContentDialog sender, ContentDialogClosingEventArgs args) { // If sign in was successful, save or clear the user name based on the user choice. if (this.Result == SignInResult.SignInOK) { if (saveUserNameCheckBox.IsChecked == true) { SaveUserName(); } else { ClearUserName(); } } // If the user entered a name and checked or cleared the 'save user name' checkbox, then clicked the back arrow, // confirm if it was their intention to save or clear the user name without signing in. if (this.Result == SignInResult.Nothing && !string.IsNullOrEmpty(userNameTextBox.Text)) { if (saveUserNameCheckBox.IsChecked == false) { args.Cancel = true; FlyoutBase.SetAttachedFlyout(this, (FlyoutBase)this.Resources["DiscardNameFlyout"]); FlyoutBase.ShowAttachedFlyout(this); } else if (saveUserNameCheckBox.IsChecked == true && !string.IsNullOrEmpty(userNameTextBox.Text)) { args.Cancel = true; FlyoutBase.SetAttachedFlyout(this, (FlyoutBase)this.Resources["SaveNameFlyout"]); FlyoutBase.ShowAttachedFlyout(this); } } }
private void ContentDialog_CloseButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { }
private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { NewTabName = textBoxNewTabName.Text; }
private void LoadGame(ContentDialog sender, ContentDialogButtonClickEventArgs args) { }
private void ContentDialog_SecondaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { }
private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { Result = TextBox.Text; }
private void ContentDialog_SecondaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { canceled = false; Hide(); }
//--------------------------------------------------------Events:---------------------------------------------------------------------\\ #region --Events-- private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { Hide(); }
private void HandleContentDialogSecondaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { return; }
private void HandleContentDialogPrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { LibraryViewModel.Current.AddMix(newName.Text); }
private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { //string name = NameTextBox.Text; //string friendlyName = FriendlyNameTextBox.Text.Length > 0 ? FriendlyNameTextBox.Text : name; //StateHelper.ViewModel.AddSubreddit(new Subreddit(name, friendlyName)); }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); Item = e.Parameter as ListedItem; PropertiesDialog = Frame.Tag as ContentDialog; }
private async void BtnEnvoyerMaCandidature_Click(object sender, RoutedEventArgs e) { if (cboResto.SelectedItem == null) { var message = new MessageDialog("Veuillez choisir un restaurant."); await message.ShowAsync();; } else if (cboPostes.SelectedItem == null) { var message = new MessageDialog("Veuillez choisir un poste."); await message.ShowAsync();; } else if (txtMotivations.Text == "") { var message = new MessageDialog("Veuillez entrer vos motivations."); await message.ShowAsync();; } else { // action=newCandidature&idCandidat={idCandidat}&idResto={idResto}&idPoste={idPoste}&motivations={motivations} // récupération des données candidature string idCandidat = lutilisateurActuellement.IdUtilisateur.ToString(); Poste lePosteChoisi = (cboPostes.SelectedItem as Poste); string idPoste = lePosteChoisi.IdPoste.ToString(); Restaurant leRestoChoisi = (cboResto.SelectedItem as Restaurant); string idResto = leRestoChoisi.IdResto.ToString(); string motivations = txtMotivations.Text; ContentDialog newCandidatureDialog = new ContentDialog { Title = "Attention !", Content = "Faites attention à bien vous relire afin de ne pas faire d'erreur.\n" + "Êtes-vous sûr(e) de vouloir postuler au restaurant " + leRestoChoisi.LibelleResto + " au poste de " + lePosteChoisi.LibellePoste + " ?", PrimaryButtonText = "Oui", CloseButtonText = "Non" }; ContentDialogResult result = await newCandidatureDialog.ShowAsync(); // Créer la candidature si l'utilisateur a cliqué sur le bouton principal ("oui") // Sinon, rien faire. if (result == ContentDialogResult.Primary) { // Créer la candidature // L'api permet de vérifier si la candidature existe déjà à l'aide de l'utilisateur et l'id du resto // Si elle n'existe pas déjà, on la créée. var reponse = await hc.GetStringAsync("http://localhost/recru_eatgood_api/index_candidat.php?" + "action=newCandidature" + "&idCandidat=" + idCandidat + "&idResto=" + idResto + "&idPoste=" + idPoste + "&motivations=" + motivations); var donnees = JsonConvert.DeserializeObject <dynamic>(reponse); var resultat = donnees["Success"]; if (resultat == "false") { var message = new MessageDialog("Vous avez déjà candidaté pour le restaurant " + leRestoChoisi.LibelleResto); await message.ShowAsync(); cboResto.SelectedItem = null;; } else { var message = new MessageDialog("Vous avez bien candidaté pour le restaurant " + leRestoChoisi.LibelleResto + " au poste de " + lePosteChoisi.LibellePoste); await message.ShowAsync(); cboResto.SelectedItem = null; cboPostes.SelectedItem = null; txtMotivations.Text = ""; await lesDonnees.ChargerLesDonnees(); this.Frame.Navigate(typeof(Page_Accueil), lesDonnees); } } else { // Ne pas créer la candidature } } }
private static void ActiveDialog_Closed(ContentDialog sender, ContentDialogClosedEventArgs args) { DialogAwaiter.SetResult(true); }
private async void Button_Tapped(object sender, TappedRoutedEventArgs e) { var title = Title.Text; var thumbnail = Url_Thumbnail.Text; var song = Url_Song.Text; if (title == "") { Title_Message.Text = "Title is empty!"; } else { Title_Message.Text = ""; } if (thumbnail == "") { Url_Thumbnail_Mesage.Text = "Thumbnail is empty!"; } else { Url_Thumbnail_Mesage.Text = ""; } if (song == "") { Url_Song_Message.Text = "Song url is empty!"; } if (Check_Url_Song(song)) { Url_Song_Message.Text = ""; } else { Url_Song_Message.Text = "Song url invalid!"; } if (Title_Message.Text == "" && Url_Thumbnail_Mesage.Text == "" && Url_Song_Message.Text == "" && Check_Url_Song(song)) { StorageFile config_login = await ApplicationData.Current.LocalFolder.GetFileAsync("config_login.json"); JObject data = JObject.Parse(await FileIO.ReadTextAsync(config_login)); Song songEntity = new Song { author = data.SelectToken("fullname").ToString(), thumbnail = thumbnail, title = title, url = song }; var rs = await ApiHandle.Upload_Song(songEntity); if (rs.Status == "OK") { ContentDialog uploadSuccess = new ContentDialog() { Title = "Upload success!", CloseButtonText = "Ok" }; await uploadSuccess.ShowAsync(); } } }
private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { fromSpace = spaces[FromCombo.SelectedIndex]; toSpace = spaces[ToCombo.SelectedIndex]; amount = double.Parse(AmountBox.Text); }
public static async Task CreateContentDialogAsync(ContentDialog Dialog, bool awaitPreviousDialog) { await CreateDialog(Dialog, awaitPreviousDialog); }
// Display receipt and ask for payment method private async void btnCheckOut_Click(object sender, RoutedEventArgs e) { string summary = ""; SubTotal = 0; btnRefresh_Click(this, new RoutedEventArgs()); // Abort action when cart is empty if (Cart.Items.Count == 0) { var dlgEmpty = new ContentDialog { Title = "Unable to checkout", Content = "There are no item placed in cart", PrimaryButtonText = "OK" }; MainPage.ReplaceDialog(dlgEmpty, sender); try { await dlgEmpty.ShowAsync(); return; } catch (Exception) { /*The dialog didn't open, probably because another dialog is already open.*/ } } // generate receipt string receipt = "\n\t Papa Dario's Pizza"; receipt += "\n\tOrdered at: " + DateTime.Now.ToString(); receipt += "\n----------------------------------------------\n\n"; foreach (Item item in Cart.Items) { receipt += item.PricedString() + "\n\n"; SubTotal += item.SubTotal; summary += item.Summary + "\n"; } if (globalProperties.IsLoggedIn) { SubTotal = (float)(SubTotal * 0.9); } Tax = (float)Math.Round((0.13 * (double)SubTotal), 2); receipt += "----------------------------------------------\n"; receipt += String.Format("{0, 38} {1, 7}\n", "Subtotal:", "$" + Math.Round(SubTotal, 2)); receipt += String.Format("{0, 38} {1, 7}\n", "Tax:", "$" + Math.Round(Tax, 2)); receipt += String.Format("{0, 38} {1, 7}\n", "Total:", "$" + Math.Round((SubTotal + Tax), 2)); receipt += "\n\n Thank you for purchasing from Papa Dario's!"; var dlg = new ReceiptDialog(receipt); MainPage.ReplaceDialog(dlg, sender); try { var result = await dlg.ShowAsync(); if (result == ContentDialogResult.Primary) { int orderId = globalProperties.PlaceOrder(summary, Math.Round(SubTotal, 2), Math.Round(Tax, 2), Math.Round((SubTotal + Tax), 2)); foreach (Item item in Cart.Items) { globalProperties.PlaceOrderedItem(orderId, item.Summary); } Cart.Items.Clear(); var dlgSuccess = new ContentDialog { Title = "Order Placed", Content = "Thank you for ordering from Papa Dario's!", PrimaryButtonText = "Close" }; MainPage.ReplaceDialog(dlgSuccess, sender); await dlgSuccess.ShowAsync(); ContentFrame.Navigate(typeof(CartPage)); } return; } catch (Exception) { /*The dialog didn't open, probably because another dialog is already open.*/ } }
public static async void CreateContentDialog(ContentDialog Dialog, bool awaitPreviousDialog) { await CreateDialog(Dialog, awaitPreviousDialog); }
private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { Link.GoBack(); }
private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { Comment = CommentText.TextDocument; }
/// <summary> /// Cancel button click event /// </summary> /// <param name="sender"></param> /// <param name="args"></param> private void ContentDialog_SecondaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { result = cdResult.AddCancel; this.Hide(); }
private void ContentDialog_SecondaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { //Nothing to do BefehlsNachricht = null; }
public async void CheckPathInput(ItemViewModel instance, string CurrentInput) { if (CurrentInput != instance.WorkingDirectory || App.CurrentInstance.ContentFrame.CurrentSourcePageType == typeof(YourHome)) { //(App.CurrentInstance.OperationsControl as RibbonArea).RibbonViewModel.HomeItems.isEnabled = false; //(App.CurrentInstance.OperationsControl as RibbonArea).RibbonViewModel.ShareItems.isEnabled = false; if (CurrentInput.Equals("Home", StringComparison.OrdinalIgnoreCase) || CurrentInput.Equals("New tab", StringComparison.OrdinalIgnoreCase)) { App.CurrentInstance.ViewModel.WorkingDirectory = "New tab"; App.CurrentInstance.ContentFrame.Navigate(typeof(YourHome), "New tab", new SuppressNavigationTransitionInfo()); } else { switch (CurrentInput.ToLower()) { case "%temp%": CurrentInput = App.AppSettings.TempPath; break; case "%appdata": CurrentInput = App.AppSettings.AppDataPath; break; case "%homepath%": CurrentInput = App.AppSettings.HomePath; break; case "%windir%": CurrentInput = App.AppSettings.WinDirPath; break; } try { await StorageFolder.GetFolderFromPathAsync(CurrentInput); if (App.AppSettings.LayoutMode == 0) // List View { App.CurrentInstance.ContentFrame.Navigate(typeof(GenericFileBrowser), CurrentInput); // navigate to folder } else { App.CurrentInstance.ContentFrame.Navigate(typeof(PhotoAlbum), CurrentInput); // navigate to folder } } catch (Exception) // Not a folder or inaccessible { try { await StorageFile.GetFileFromPathAsync(CurrentInput); await Interaction.InvokeWin32Component(CurrentInput); } catch (Exception ex) // Not a file or not accessible { // Launch terminal application if possible var localSettings = ApplicationData.Current.LocalSettings; foreach (var item in App.AppSettings.Terminals) { if (item.Path.Equals(CurrentInput, StringComparison.OrdinalIgnoreCase) || item.Path.Equals(CurrentInput + ".exe", StringComparison.OrdinalIgnoreCase)) { localSettings.Values["Application"] = item.Path; localSettings.Values["Arguments"] = String.Format(item.arguments, App.CurrentInstance.ViewModel.WorkingDirectory); await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync(); return; } } var dialog = new ContentDialog() { Title = "Invalid item", Content = "The item referenced is either invalid or inaccessible.\nMessage:\n\n" + ex.Message, CloseButtonText = "OK" }; await dialog.ShowAsync(); } } } App.CurrentInstance.NavigationToolbar.PathControlDisplayText = App.CurrentInstance.ViewModel.WorkingDirectory; } }
public MainPage() { this.InitializeComponent(); // Construct a temporary object model tree until the parser is available AdaptiveCard card = new AdaptiveCard(); AdaptiveContainer container1 = new AdaptiveContainer(); AdaptiveTextBlock textBlock1 = new AdaptiveTextBlock(); textBlock1.Text = "Hello"; textBlock1.Weight = TextWeight.Normal; textBlock1.Color = TextColor.Warning; textBlock1.Size = TextSize.Large; container1.Items.Add(textBlock1); AdaptiveTextBlock textBlock2 = new AdaptiveTextBlock(); textBlock2.Text = "World"; textBlock2.Weight = TextWeight.Normal; textBlock2.Color = TextColor.Accent; container1.Items.Add(textBlock2); card.Body.Add(container1); AdaptiveContainer container2 = new AdaptiveContainer(); AdaptiveTextBlock textBlock3 = new AdaptiveTextBlock(); textBlock3.Text = "In new container"; textBlock3.Weight = TextWeight.Normal; textBlock3.Color = TextColor.Default; container2.Items.Add(textBlock3); card.Body.Add(container2); AdaptiveImage image = new AdaptiveImage(); image.Url = new Uri("https://unsplash.it/360/202?image=883"); card.Body.Add(image); m_renderer = new AdaptiveCards.XamlCardRenderer.XamlCardRenderer(); AdaptiveHostConfig hostConfig = AdaptiveHostConfig.CreateHostConfigFromJson(hostConfigString); m_renderer.SetHostConfig(hostConfig); m_renderer.Action += async(sender, e) => { if (m_actionDialog != null) { m_actionDialog.Hide(); } m_actionDialog = new ContentDialog(); if (e.Action.ActionType == ActionType.ShowCard) { AdaptiveShowCardAction showCardAction = (AdaptiveShowCardAction)e.Action; m_actionDialog.Content = await m_renderer.RenderCardAsXamlAsync(showCardAction.Card); } else { m_actionDialog.Content = "We got an action!\n" + e.Action.ActionType + "\n" + e.Inputs; } m_actionDialog.PrimaryButtonText = "Close"; await m_actionDialog.ShowAsync(); }; PopulateXamlContent(card); }
private void Dialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { Application.Current.Exit(); }
private void Close(ContentDialog contentDialog) { contentDialog.Hide(); }
private void dialog_createClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { Frame.Navigate(typeof(TaskDetailedView), data); }
private void Dialog_SecondaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { waitDialog = true; MoveOnGrid(); }
private void Dialog_CloseButton(ContentDialog sender, ContentDialogButtonClickEventArgs args) { dialog.Hide(); }
private async void ReportExecute() { var user = Item as TLUser; if (user != null) { var opt1 = new RadioButton { Content = "Spam", Margin = new Thickness(0, 8, 0, 8), HorizontalAlignment = HorizontalAlignment.Stretch }; var opt2 = new RadioButton { Content = "Violence", Margin = new Thickness(0, 8, 0, 8), HorizontalAlignment = HorizontalAlignment.Stretch }; var opt3 = new RadioButton { Content = "Pornography", Margin = new Thickness(0, 8, 0, 8), HorizontalAlignment = HorizontalAlignment.Stretch }; var opt4 = new RadioButton { Content = "Other", Margin = new Thickness(0, 8, 0, 8), HorizontalAlignment = HorizontalAlignment.Stretch, IsChecked = true }; var stack = new StackPanel(); stack.Children.Add(opt1); stack.Children.Add(opt2); stack.Children.Add(opt3); stack.Children.Add(opt4); stack.Margin = new Thickness(0, 16, 0, 0); var dialog = new ContentDialog(); dialog.Content = stack; dialog.Title = "Resources.Report"; dialog.IsPrimaryButtonEnabled = true; dialog.IsSecondaryButtonEnabled = true; dialog.PrimaryButtonText = "Resources.OK"; dialog.SecondaryButtonText = "Resources.Cancel"; var dialogResult = await dialog.ShowQueuedAsync(); if (dialogResult == ContentDialogResult.Primary) { var reason = opt1.IsChecked == true ? new TLInputReportReasonSpam() : (opt2.IsChecked == true ? new TLInputReportReasonViolence() : (opt3.IsChecked == true ? new TLInputReportReasonPornography() : (TLReportReasonBase) new TLInputReportReasonOther())); if (reason.TypeId == TLType.InputReportReasonOther) { var input = new InputDialog(); input.Title = "Resources.Report"; input.PlaceholderText = "Resources.Description"; input.IsPrimaryButtonEnabled = true; input.IsSecondaryButtonEnabled = true; input.PrimaryButtonText = "Resources.OK"; input.SecondaryButtonText = "Resources.Cancel"; var inputResult = await input.ShowQueuedAsync(); if (inputResult == ContentDialogResult.Primary) { reason = new TLInputReportReasonOther { Text = input.Text }; } else { return; } } var result = await ProtoService.ReportPeerAsync(user.ToInputPeer(), reason); if (result.IsSucceeded && result.Result) { await new TLMessageDialog("Resources.ReportSpamNotification", "Unigram").ShowQueuedAsync(); } } } }