internal static async Task ShowFatalErrorAsync <TErrorPage>(string titleResourceKey, string contentResourceKey) where TErrorPage : Page, new() { await CoreApplication.MainView.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() => { //var errorDialog = new ContentDialog //{ // Title = ErrorMessageHelper.GetErrorMessageResource(titleResourceKey), // Content = ErrorMessageHelper.GetErrorMessageResource(contentResourceKey) //}.SetPrimaryButton(ErrorMessageHelper.GetErrorMessageResource("ExitApp")); var errorDialog = new ContentDialog { Title = ErrorMessageHelper.GetErrorMessageResource(titleResourceKey), Content = ErrorMessageHelper.GetErrorMessageResource(contentResourceKey) }; errorDialog.Closing += ErrorDialog_Closing; await errorDialog.ShowOneAtATimeAsync(); // if the error is fatal, then the app should either be closed, or disabled #if __WASM__ Window.Current.Content = new TErrorPage(); #else Application.Current.Exit(); #endif }); }
internal static async Task ShowErrorAsync(string titleResourceKey, string contentResourceKey) { await CoreApplication.MainView.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() => { var errorDialog = new ContentDialog { Title = ErrorMessageHelper.GetErrorMessageResource(titleResourceKey), Content = ErrorMessageHelper.GetErrorMessageResource(contentResourceKey) }.SetPrimaryButton(ErrorMessageHelper.GetErrorMessageResource("Ok")); await errorDialog.ShowOneAtATimeAsync(); }); }
public async Task ShowErrorMessageAsync(string message, string title) { try { var errorDialog = new ContentDialog { Title = title, Content = message }.SetPrimaryButton("Ok"); await errorDialog.ShowOneAtATimeAsync(); } catch { } }
public async Task ShowInfoMessageAsync(string message, string title) { try { var infoDialog = new ContentDialog { Title = title, Content = message }.SetPrimaryButton("Schließen"); await infoDialog.ShowOneAtATimeAsync(); } catch { } }
public async Task <bool> AskYesOrNoAsync(string message, string title) { bool result = false; var askDialog = new ContentDialog { Title = title, Content = message }.SetPrimaryButton("Ja", (d, e) => { result = true; }).SetSecondaryButton("Nein", (d, e) => { result = false; }); await askDialog.ShowOneAtATimeAsync(); return(result); }