本文整理汇总了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;
}
示例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();
}
示例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();
}
示例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)
{
}
}
}
示例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();
}
}
示例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
}
}
示例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
示例8: CancelPreviousAndShowDialog
protected void CancelPreviousAndShowDialog(ContentDialog dialog)
{
if (previous == null)
previous = dialog;
CancelPreviousDialog();
LastDialogControl = dialog.ShowAsync();
}
示例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)
{
}
}
}
示例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();
}
示例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();
}
示例12: Error
private async void Error(string title)
{
ContentDialog dialogo = new ContentDialog();
dialogo.PrimaryButtonText = "Ок";
dialogo.Title = title;
await dialogo.ShowAsync();
}
示例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();
}
}
示例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();
}
示例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();
}