本文整理汇总了C#中Windows.UI.Popups.MessageDialog.ShowAsync方法的典型用法代码示例。如果您正苦于以下问题:C# Windows.UI.Popups.MessageDialog.ShowAsync方法的具体用法?C# Windows.UI.Popups.MessageDialog.ShowAsync怎么用?C# Windows.UI.Popups.MessageDialog.ShowAsync使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Windows.UI.Popups.MessageDialog
的用法示例。
在下文中一共展示了Windows.UI.Popups.MessageDialog.ShowAsync方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnNavigatedTo
protected override void OnNavigatedTo(NavigationEventArgs e)
{
drug = e.Parameter as string;
Windows.UI.Popups.MessageDialog m = new Windows.UI.Popups.MessageDialog("what is this: " + drug);
m.ShowAsync();
}
示例2: OnNavigatedTo
protected override void OnNavigatedTo(NavigationEventArgs e)
{
json = e.Parameter as string;
Windows.UI.Popups.MessageDialog m = new Windows.UI.Popups.MessageDialog("Test: " + json);
m.ShowAsync();
}
示例3: GetUserRoles
public static async Task GetUserRoles(ObservableCollection<UserRole> UserRoleList)
{
var response = await http.GetAsync("http://uwproject.feifei.ca/api/ApplicationRoles");
if (response.IsSuccessStatusCode)
{
var result = await response.Content.ReadAsStringAsync();
JsonValue value = JsonValue.Parse(result);
JsonArray root = value.GetArray();
for (uint i = 0; i < root.Count; i++)
{
string id = root.GetObjectAt(i).GetNamedString("Id");
string name = root.GetObjectAt(i).GetNamedString("Name");
var userRole = new UserRole
{
Id = id,
Name = name
};
UserRoleList.Add(userRole);
}
}
else
{
var dialog = new Windows.UI.Popups.MessageDialog("Cannot retrieve any record");
await dialog.ShowAsync();
}
}
示例4: CaptureImage
public async void CaptureImage()
{
var dialog = new Windows.UI.Popups.MessageDialog("Would you like to use your camera or select a picture from your library?");
dialog.Commands.Add(new Windows.UI.Popups.UICommand("I'd like to use my camera", null, "camera"));
dialog.Commands.Add(new Windows.UI.Popups.UICommand("I already have the picture", null, "picker"));
IStorageFile photoFile;
var command = await dialog.ShowAsync();
if ((string) command.Id == "camera")
{
var cameraCapture = new Windows.Media.Capture.CameraCaptureUI();
photoFile = await cameraCapture.CaptureFileAsync(Windows.Media.Capture.CameraCaptureUIMode.Photo);
}
else
{
var photoPicker = new FileOpenPicker();
photoPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
photoPicker.FileTypeFilter.Add(".png");
photoPicker.FileTypeFilter.Add(".jpg");
photoPicker.FileTypeFilter.Add(".jpeg");
photoFile = await photoPicker.PickSingleFileAsync();
}
if (photoFile == null)
return;
var raStream = await photoFile.OpenAsync(FileAccessMode.Read);
Customer.ImageStream = raStream.AsStream();
}
示例5: getPredictFailure
public async void getPredictFailure()
{
try
{
List<string> QList = new List<string>();
List<Double> FList = new List<Double>();
var q = ParseObject.GetQuery("FailureNextWeek");
// where allgroupname.Get<string>("EquipmentName") != ""
// select allgroupname;
var f = await q.FindAsync();
foreach (var obj in f)
{
QList.Add(obj.Get<String>("EquipmentName"));
FList.Add(obj.Get<Double>("FailureProbability"));
EquipmentNamelistView.ItemsSource = QList;
FPlistView.ItemsSource = FList;
}
}
catch (Exception ex)
{
Windows.UI.Popups.MessageDialog md = new Windows.UI.Popups.MessageDialog(ex.Message);
md.ShowAsync();
}
}
示例6: button_Click
private async void button_Click(object sender, RoutedEventArgs e)
{
pickedContact = null;
var contactPicker = new Windows.ApplicationModel.Contacts.ContactPicker();
contactPicker.DesiredFieldsWithContactFieldType.Add(ContactFieldType.PhoneNumber);
var contact = await contactPicker.PickContactAsync();
if (contact != null)
{
string msg = "Got contact " + contact.DisplayName + " with phone numbers: ";
foreach (var phone in contact.Phones)
{
msg += (phone.Kind.ToString() + " " + phone.Number);
}
var dlg = new Windows.UI.Popups.MessageDialog(msg);
await dlg.ShowAsync();
pickedContact = contact;
}
}
示例7: IsValid
private static async Task<bool> IsValid(OrderViewModel orderViewModel)
{
if (string.IsNullOrWhiteSpace(orderViewModel.Customer))
{
var messageBox = new Windows.UI.Popups.MessageDialog("You must specify a customer name.", "Warning!");
await messageBox.ShowAsync();
return false;
}
if (string.IsNullOrWhiteSpace(orderViewModel.SelectedProduct))
{
var messageBox = new Windows.UI.Popups.MessageDialog("You must select a product.", "Warning!");
await messageBox.ShowAsync();
return false;
}
if (orderViewModel.SelectedAmount == -1)
{
var messageBox = new Windows.UI.Popups.MessageDialog("You must select an amount.", "Warning!");
await messageBox.ShowAsync();
return false;
}
return true;
}
示例8: GetYearTerms
public static async Task GetYearTerms(ObservableCollection<YearTerm> YearTermsList)
{
var response = await http.GetAsync("http://uwproject.feifei.ca/api/YearTerms");
if (response.IsSuccessStatusCode)
{
var result = await response.Content.ReadAsStringAsync();
JsonValue value = JsonValue.Parse(result);
JsonArray root = value.GetArray();
for (uint i = 0; i < root.Count; i++)
{
int yearTermId = (int)root.GetObjectAt(i).GetNamedNumber("YearTermId");
int year = (int)root.GetObjectAt(i).GetNamedNumber("Year");
int term = (int)root.GetObjectAt(i).GetNamedNumber("Term");
bool isDefault = root.GetObjectAt(i).GetNamedBoolean("IsDefault");
string description = root.GetObjectAt(i).GetNamedString("Description");
var yearTerm = new YearTerm
{
YearTermId = yearTermId,
Year = year,
Term = term,
IsDefault = isDefault,
};
YearTermsList.Add(yearTerm);
}
}
else
{
var dialog = new Windows.UI.Popups.MessageDialog("Cannot retrieve any record");
await dialog.ShowAsync();
}
}
示例9: RecognizeWithSRGSGrammarFileConstraintOnce_Click
private async void RecognizeWithSRGSGrammarFileConstraintOnce_Click(object sender, RoutedEventArgs e)
{
this.heardYouSayTextBlock.Visibility = this.resultTextBlock.Visibility = Visibility.Collapsed;
// Start recognition.
try
{
Windows.Media.SpeechRecognition.SpeechRecognitionResult speechRecognitionResult = await this.speechRecognizer.RecognizeWithUIAsync();
// If successful, display the recognition result.
if (speechRecognitionResult.Status == Windows.Media.SpeechRecognition.SpeechRecognitionResultStatus.Success)
{
this.heardYouSayTextBlock.Visibility = this.resultTextBlock.Visibility = Visibility.Visible;
this.resultTextBlock.Text = speechRecognitionResult.Text;
}
}
catch (Exception exception)
{
if ((uint)exception.HResult == App.HResultPrivacyStatementDeclined)
{
this.resultTextBlock.Visibility = Visibility.Visible;
this.resultTextBlock.Text = "The privacy statement was declined.";
}
else
{
var messageDialog = new Windows.UI.Popups.MessageDialog(exception.Message, "Exception");
messageDialog.ShowAsync().GetResults();
}
}
this.InitializeSpeechRecognizer();
}
开发者ID:xitxat,项目名称:SpeechRecognitionAndTTSQuickstart,代码行数:31,代码来源:SRGSGrammarFileConstraintPage.xaml.cs
示例10: AskForReviewAsync
private async Task AskForReviewAsync()
{
var messageDialog = new Windows.UI.Popups.MessageDialog(RateMyApp.REVIEW_TEXT);
messageDialog.Commands.Add(new Windows.UI.Popups.UICommand(RateMyApp.REVIEW_INVITE_TEXT,
async (action) =>
{
#if WINDOWS_PHONE_APP
var uri = new Uri("ms-windows-store:reviewapp?appid=" + CurrentApp.AppId);
#elif WINDOWS_APP
var uri = new Uri("ms-windows-store:Review?PFN=" + Windows.ApplicationModel.Package.Current.Id.FamilyName);
#endif
await Windows.System.Launcher.LaunchUriAsync(uri);
this.status["userReviewedApp"] = true;
this.SaveReviewStatus();
}
));
messageDialog.Commands.Add(new Windows.UI.Popups.UICommand(RateMyApp.REVIEW_DECLINE_TEXT, null));
messageDialog.DefaultCommandIndex = 0;
messageDialog.CancelCommandIndex = 1;
await messageDialog.ShowAsync();
}
示例11: LoadState
protected override async void LoadState(Object navigationParameter, Dictionary<String, Object> pageState)
{
MarktplaatsItems feedDataSource = (MarktplaatsItems)App.Current.Resources["feedDataSource"];
var connectionProfile = Windows.Networking.Connectivity.NetworkInformation.GetInternetConnectionProfile();
if (connectionProfile != null)
{
MarktPlaatsConnection mp = new MarktPlaatsConnection();
if (feedDataSource != null)
{
feedDataSource = await mp.GetMarktplaatsItems(navigationParameter.ToString());
}
}
else
{
var messageDialog = new Windows.UI.Popups.MessageDialog("An internet connection is needed to download feeds. Please check your connection and restart the app.");
var result = messageDialog.ShowAsync();
}
if (feedDataSource != null)
{
this.DefaultViewModel["Items"] = feedDataSource.Items;
App.Current.Resources["feedDataSource"] = feedDataSource;
}
}
示例12: onClickSiguiente
private async void onClickSiguiente(object sender, RoutedEventArgs e)
{
this.nombre = nombrePlan.Text;
this.descripcion = descripcionPlan.Text;
this.fecha = fechaPlan.Date.Day + "/" + fechaPlan.Date.Month + "/" + fechaPlan.Date.Year;
this.hora = configurarHora(horaPlan.Time.Hours, horaPlan.Time.Minutes);
if (nombre.Equals("") && descripcion.Equals(""))
{
var dialog = new Windows.UI.Popups.MessageDialog("Por favor llene los campos");
dialog.Commands.Add(new Windows.UI.Popups.UICommand("OK") { Id = 0 });
var result = await dialog.ShowAsync();
}
else
{
if (photo == null)
{
var packageLocation = Windows.ApplicationModel.Package.Current.InstalledLocation;
var assetsFolder = await packageLocation.GetFolderAsync("Assets");
photo = await assetsFolder.GetFileAsync("fotoplan.jpg");
}
Plan plan = new Plan()
{
NombrePlan = nombre,
DescripcionPlan = descripcion,
FechaPlan = fecha,
HoraPlan = hora,
ImagenPlan = photo
};
Frame rootFrame = Window.Current.Content as Frame;
rootFrame.Navigate(typeof(AddMapa), plan);
}
}
示例13: BookReseravation_Click
private async void BookReseravation_Click(Book book)
{
var loader = new Windows.ApplicationModel.Resources.ResourceLoader();
string strVR = loader.GetString("ValideReservation");
string yes = loader.GetString("Yes");
string no = loader.GetString("No");
var dialog = new Windows.UI.Popups.MessageDialog(book.Title+"\n" + strVR);
dialog.Commands.Add(new Windows.UI.Popups.UICommand(yes) { Id = 1 });
dialog.Commands.Add(new Windows.UI.Popups.UICommand(no) { Id = 0 });
var result = await dialog.ShowAsync();
if ((int)result.Id == 1)
{
var duplicate = false;
foreach (var b in bookReservation)
{
if (b.NumBook == book.NumBook)
duplicate = true;
}
if(duplicate == false)
bookReservation.Add(book);
else
{
var str = loader.GetString("Duplicate");
dialog = new Windows.UI.Popups.MessageDialog(str);
await dialog.ShowAsync();
}
}
}
示例14: OnNavigatedTo
protected async override void OnNavigatedTo(NavigationEventArgs e)
{
var deviceInfo = await SmartCardReaderUtils.GetDefaultSmartCardReaderInfo();
if (deviceInfo == null)
{
LogMessage("NFC card reader mode not supported on this device", NotifyType.ErrorMessage);
return;
}
if (!deviceInfo.IsEnabled)
{
var msgbox = new Windows.UI.Popups.MessageDialog("Your NFC proximity setting is turned off, you will be taken to the NFC proximity control panel to turn it on");
msgbox.Commands.Add(new Windows.UI.Popups.UICommand("OK"));
await msgbox.ShowAsync();
// This URI will navigate the user to the NFC proximity control panel
NfcUtils.LaunchNfcProximitySettingsPage();
return;
}
if (m_cardReader == null)
{
m_cardReader = await SmartCardReader.FromIdAsync(deviceInfo.Id);
m_cardReader.CardAdded += cardReader_CardAdded;
m_cardReader.CardRemoved += cardReader_CardRemoved;
}
}
示例15: GetOptions
public static async Task GetOptions(ObservableCollection<Option> OptionsList)
{
var response = await http.GetAsync("http://uwproject.feifei.ca/api/Options");
if (response.IsSuccessStatusCode)
{
var result = await response.Content.ReadAsStringAsync();
JsonValue value = JsonValue.Parse(result);
JsonArray root = value.GetArray();
for (uint i = 0; i < root.Count; i++)
{
int optionId = (int)root.GetObjectAt(i).GetNamedNumber("OptionId");
string title = root.GetObjectAt(i).GetNamedString("Title");
bool isActive = root.GetObjectAt(i).GetNamedBoolean("IsActive");
var option = new Option
{
OptionId = optionId,
Title = title,
IsActive = isActive,
};
OptionsList.Add(option);
}
}
else
{
var dialog = new Windows.UI.Popups.MessageDialog("Cannot retrieve any record");
await dialog.ShowAsync();
}
}