当前位置: 首页>>代码示例>>C#>>正文


C# ContentDialog.ShowAsync方法代码示例

本文整理汇总了C#中ContentDialog.ShowAsync方法的典型用法代码示例。如果您正苦于以下问题:C# ContentDialog.ShowAsync方法的具体用法?C# ContentDialog.ShowAsync怎么用?C# ContentDialog.ShowAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ContentDialog的用法示例。


在下文中一共展示了ContentDialog.ShowAsync方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TeamOneName

        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;          
        }
开发者ID:Martinc94,项目名称:MobileAppsProject,代码行数:25,代码来源:GaaScore.xaml.cs

示例2: buttonConnect_Click

        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();
        }
开发者ID:derwish-pro,项目名称:Arduino-Led-Strip-Controller,代码行数:34,代码来源:ConnectPage.xaml.cs

示例3: showDialog

        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();
        }
开发者ID:Intrexion,项目名称:UWP-Hue,代码行数:27,代码来源:ListPage.xaml.cs

示例4: button_Click

 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)
         {
         }
     }
 }
开发者ID:yann510,项目名称:HolidayList,代码行数:27,代码来源:PersonGiftLift.xaml.cs

示例5: Tela_PrimaryButtonClick

        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();


            }

        }
开发者ID:SuchGlasha,项目名称:CashManagerDGK,代码行数:31,代码来源:MyUserControl1.xaml.cs

示例6: CallWebApiAsync

        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
            }  
        }
开发者ID:ChachaIG,项目名称:appMeteo,代码行数:29,代码来源:MainPage.xaml.cs

示例7: StartRecognizing_Click

        } // 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
开发者ID:AlbertMcLa,项目名称:Template10-sample,代码行数:35,代码来源:BlankPage1.xaml.cs

示例8: CancelPreviousAndShowDialog

 protected void CancelPreviousAndShowDialog(ContentDialog dialog)
 {
     if (previous == null)
         previous = dialog;
     CancelPreviousDialog();
     LastDialogControl = dialog.ShowAsync();
 }
开发者ID:patel-pragnesh,项目名称:PowerMonitor,代码行数:7,代码来源:BasePage.cs

示例9: buttonAddPerson_Click

 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)
         {
         }
     }
 }
开发者ID:yann510,项目名称:HolidayList,代码行数:31,代码来源:MainPage.xaml.cs

示例10: ShowContentDialog

        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();
        }
开发者ID:mistryhardik,项目名称:iothandson,代码行数:25,代码来源:Helpers.cs

示例11: OnTakeScreenshotButtonClicked

        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();
        }
开发者ID:Esri,项目名称:arcgis-runtime-samples-dotnet,代码行数:27,代码来源:TakeScreenshot.xaml.cs

示例12: Error

 private async void Error(string title)
 {
     ContentDialog dialogo = new ContentDialog();
     dialogo.PrimaryButtonText = "Ок";
     dialogo.Title = title;
     await dialogo.ShowAsync();
 }
开发者ID:SuchGlasha,项目名称:CashManagerDGK,代码行数:7,代码来源:AddNewHistory.xaml.cs

示例13: button_Click

        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();
            }
        }
开发者ID:myCodePixel,项目名称:blogsamples,代码行数:32,代码来源:MainPage.xaml.cs

示例14: ShowNoAccessDialog

        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();
        }
开发者ID:Vedolin,项目名称:wheelmap-windows-app,代码行数:25,代码来源:LocationManager.cs

示例15: Button_Click

 private async void Button_Click(object sender, RoutedEventArgs e)
 {
     ContentDialog d = new ContentDialog();
     d.Title = "Not implemented";
     d.Content = "The buttons are for illustrative purposes only and do not perform any action";
     d.PrimaryButtonText = "OK";
     await d.ShowAsync();
 }
开发者ID:C-C-D-I,项目名称:Windows-universal-samples,代码行数:8,代码来源:MainPage.xaml.cs


注:本文中的ContentDialog.ShowAsync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。