本文整理汇总了C#中Windows.UI.Popups.MessageDialog类的典型用法代码示例。如果您正苦于以下问题:C# Windows.UI.Popups.MessageDialog类的具体用法?C# Windows.UI.Popups.MessageDialog怎么用?C# Windows.UI.Popups.MessageDialog使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Windows.UI.Popups.MessageDialog类属于命名空间,在下文中一共展示了Windows.UI.Popups.MessageDialog类的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: MainPage_Loaded
private async void MainPage_Loaded(object sender, RoutedEventArgs e)
{
SetupPersonGroup();
dispatcher = CoreWindow.GetForCurrentThread().Dispatcher;
bool permissionGained = await RequestMicrophonePermission();
if (!permissionGained)
return; // No permission granted
Language speechLanguage = SpeechRecognizer.SystemSpeechLanguage;
string langTag = speechLanguage.LanguageTag;
speechContext = ResourceContext.GetForCurrentView();
speechContext.Languages = new string[] { langTag };
speechResourceMap = ResourceManager.Current.MainResourceMap.GetSubtree("LocalizationSpeechResources");
await InitializeRecognizer(SpeechRecognizer.SystemSpeechLanguage);
try
{
await speechRecognizer.ContinuousRecognitionSession.StartAsync();
}
catch (Exception ex)
{
var messageDialog = new Windows.UI.Popups.MessageDialog(ex.Message, "Exception");
await messageDialog.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: getRemainingUsefullLife
public async void getRemainingUsefullLife()
{
try
{
List<string> QList = new List<string>();
List<Double> TList = new List<Double>();
var q = from allgroupname in ParseObject.GetQuery("RemainingUsefulLife")
where allgroupname.Get<string>("EquipmentName") != ""
select allgroupname;
var f = await q.FindAsync();
foreach (var obj in f)
{
QList.Add(obj.Get<String>("EquipmentName"));
TList.Add(obj.Get<Double>("TTL"));
EquipmentNamelistView.ItemsSource = QList;
TTLlistView.ItemsSource = TList;
}
}
catch (Exception ex)
{
Windows.UI.Popups.MessageDialog md = new Windows.UI.Popups.MessageDialog(ex.Message);
md.ShowAsync();
}
}
开发者ID:gsg-business-innovation-lab,项目名称:Field_Intelligence,代码行数:35,代码来源:RemainingUsefulLifeWeek.xaml.cs
示例5: CreateButton_Click
private async void CreateButton_Click(object sender, RoutedEventArgs e)
{
if (!App.HasConnectivity)
{
var messageDialog = new Windows.UI.Popups.MessageDialog("You can't create a Read it Later account until you have Internet access. Please try again once you're connected to the Internet.", "Error");
await messageDialog.ShowAsync();
return;
}
if (!string.IsNullOrWhiteSpace(passwordPasswordBox.Password) &&
!string.IsNullOrWhiteSpace(usernameTextBox.Text))
{
var username = usernameTextBox.Text;
var password = passwordPasswordBox.Password;
var api = new ReadItLaterApi.Metro.ReadItLaterApi(username, password);
if (await api.CreateAccount())
{
SaveSettings(usernameTextBox.Text.Trim(), passwordPasswordBox.Password);
Hide();
}
else
{
var messageDialog = new Windows.UI.Popups.MessageDialog("There was an error creating your Read it Later account. Please try again later.", "Error");
await messageDialog.ShowAsync();
}
}
}
示例6: saveEditRecordatorio
private async void saveEditRecordatorio(object sender, RoutedEventArgs e)
{
if (validarDatos() == 1) //campos validados
{
fact.Alarma = getFechaAlarma();
fact.Estado = "Pendiente";
fact.Valor = Convert.ToInt32(txtValor.Text);
factDao.updateFactura(fact); //actualizo el objeto en la base de datos, y se actualiza en la coleccion de objetos
//redirijo a la MainPage
rootFrame.Navigate(typeof(MainPage), "1");
}
if (validarDatos() == 2) //problemas con la fecha
{
var dialog = new Windows.UI.Popups.MessageDialog("No te podemos notificar " + (txtDia.SelectedIndex + 1) + " días antes, el día límite es el " + txtVence.Text, "Algo sucede!");
dialog.Commands.Add(new Windows.UI.Popups.UICommand("Entendido") { Id = 1 });
var result = await dialog.ShowAsync();
}
if (validarDatos() == 0)
{
var dialog = new Windows.UI.Popups.MessageDialog("Falta información para crear el recordatorio", "Falta Información!");
dialog.Commands.Add(new Windows.UI.Popups.UICommand("Entendido") { Id = 1 });
var result = await dialog.ShowAsync();
}
}
示例7: cambiarMiInfo
private async void cambiarMiInfo(object sender, RoutedEventArgs e)
{
Esperar1.Visibility = Visibility.Visible;
try
{
var trata = new ParseObject("User");
trata.ObjectId = usu.Id;
trata["Nombre"] = nombre.Text;
trata["Apellido"] = apellido.Text;
trata["email"] = correo.Text;
trata["telefono"] = int.Parse(telefono.Text);
trata["cedula"] = cedula.Text;
trata["username"] = username.Text;
trata["password"] = password.Password;
usu.Nombre = nombre.Text;
usu.Apellido = apellido.Text;
usu.Correo = correo.Text;
usu.Telefono = uint.Parse(telefono.Text);
usu.Cedula = cedula.Text;
usu.Username = username.Text;
usu.Password = password.Password;
await trata.SaveAsync();
Esperar1.Visibility = Visibility.Collapsed;
}
catch (Exception ex)
{
Esperar1.Visibility = Visibility.Collapsed;
var dialog = new Windows.UI.Popups.MessageDialog("Tu información no ha podido ser editada");
dialog.Commands.Add(new Windows.UI.Popups.UICommand("OK") { });
var result = await dialog.ShowAsync();
}
}
示例8: OnTargetFileRequested
private async void OnTargetFileRequested(FileSavePickerUI sender, TargetFileRequestedEventArgs e)
{
// This scenario demonstrates how the app can go about handling the TargetFileRequested event on the UI thread, from
// which the app can manipulate the UI, show error dialogs, etc.
// Requesting a deferral allows the app to return from this event handler and complete the request at a later time.
// In this case, the deferral is required as the app intends on handling the TargetFileRequested event on the UI thread.
// Note that the deferral can be requested more than once but calling Complete on the deferral a single time will complete
// original TargetFileRequested event.
var deferral = e.Request.GetDeferral();
await dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () =>
{
// This method will be called on the app's UI thread, which allows for actions like manipulating
// the UI or showing error dialogs
// Display a dialog indicating to the user that a corrective action needs to occur
var errorDialog = new Windows.UI.Popups.MessageDialog("If the app needs the user to correct a problem before the app can save the file, the app can use a message like this to tell the user about the problem and how to correct it.");
await errorDialog.ShowAsync();
// Set the targetFile property to null and complete the deferral to indicate failure once the user has closed the
// dialog. This will allow the user to take any neccessary corrective action and click the Save button once again.
e.Request.TargetFile = null;
deferral.Complete();
});
}
示例9: SaveButton_Click
private async void SaveButton_Click(object sender, RoutedEventArgs e)
{
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
// Dropdown of file types the user can save the file as
savePicker.FileTypeChoices.Add("Rich Text", new List<string>() { ".rtf" });
// Default file name if the user does not type one in or select a file to replace
savePicker.SuggestedFileName = "New Document";
StorageFile file = await savePicker.PickSaveFileAsync();
if (file != null)
{
// Prevent updates to the remote version of the file until we
// finish making changes and call CompleteUpdatesAsync.
CachedFileManager.DeferUpdates(file);
// write to file
using (Windows.Storage.Streams.IRandomAccessStream randAccStream =
await file.OpenAsync(Windows.Storage.FileAccessMode.ReadWrite))
{
editor.Document.SaveToStream(Windows.UI.Text.TextGetOptions.FormatRtf, randAccStream);
}
// Let Windows know that we're finished changing the file so the
// other app can update the remote version of the file.
FileUpdateStatus status = await CachedFileManager.CompleteUpdatesAsync(file);
if (status != FileUpdateStatus.Complete)
{
Windows.UI.Popups.MessageDialog errorBox =
new Windows.UI.Popups.MessageDialog("File " + file.Name + " couldn't be saved.");
await errorBox.ShowAsync();
}
}
}
示例10: GetActiveOptions
public static async Task GetActiveOptions(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");
if (isActive == true)
{
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();
}
}
示例11: 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();
}
}
}
示例12: 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();
}
示例13: 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();
}
}
示例14: 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();
}
}
示例15: 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;
}
}