/// <summary> /// Shows a dialog. Primarybutton set /// </summary> /// <param name="content">Any string to display</param> /// <param name="title">Title of Dialog</param> /// <returns></returns> public async Task ShowDialogAsync(string content, string title = null) { var dialog = new ShowDialog { SymbolString = SYMBOL_INFO, ContentString = content.GetLocalized(), PrimaryButtonText = "DialogContinue".GetLocalized(), Title = title.GetLocalized(), }; await dialog.ShowAsync(); }
/// <summary> /// Shows an error dialog. Primarybutton and title set /// </summary> /// <param name="exception">Exception to show</param> /// <returns></returns> public async Task ShowErrorDialogAsync(string error) { var dialog = new ShowDialog { SymbolString = SYMBOL_ERROR, ContentString = error, PrimaryButtonText = "DialogDismiss".GetLocalized(), Title = "DialogError".GetLocalized(), }; await dialog.ShowAsync(); }
/// <summary> /// Shows a dialog for user feedback /// </summary> /// <param name="content">Any string to display</param> /// <param name="okCallback">ICommand for user feedback</param> /// <param name="title">Title of dialog</param> /// <param name="okButtonText">Text for Primary button</param> /// <param name="cancelButtonText">Text for Secondary button</param> /// <returns></returns> public async Task ShowActionDialogAsync(string content, ICommand okCallback, string title = null, string okButtonText = "DialogOk", string cancelButtonText = "DialogCancel") { var dialog = new ShowDialog { SymbolString = SYMBOL_QUESTION, ContentString = content.GetLocalized(), PrimaryButtonText = okButtonText.GetLocalized(), PrimaryButtonCommand = okCallback, SecondaryButtonText = cancelButtonText.GetLocalized(), Title = title.GetLocalized(), }; await dialog.ShowAsync(); }
/// <summary> /// Ask the user to rate the app. Positiv answer will open the storeapp /// </summary> /// <returns></returns> public async Task ShowStoreRatingDialogAsync() { var dialog = new ShowDialog { SymbolString = SYMBOL_VERBOSE, ContentString = "DialogRateAppContent".GetLocalized(), PrimaryButtonText = "DialogYes".GetLocalized(), PrimaryButtonCommand = new DelegateCommand(async() => await Launcher.LaunchUriAsync(new Uri($"ms-windows-store:REVIEW?PFN={Package.Current.Id.FamilyName}"))), SecondaryButtonText = "DialogNotYet".GetLocalized(), Title = "DialogRateAppTitle".GetLocalized(), }; await dialog.ShowAsync(); }
/// <summary> /// Shows an error dialog. Primarybutton and title set /// </summary> /// <param name="exception">Exception to show</param> /// <returns></returns> public async Task ShowErrorDialogAsync(Exception exception) { StringBuilder sb = new StringBuilder(); sb.AppendLine(string.Format("{0}: {1}", "DialogErrorMessage".GetLocalized(), exception.Message)); sb.AppendLine(string.Format("{0}: 0x{1:X})", "DialogUnhandledError".GetLocalized(), exception.HResult)); var dialog = new ShowDialog { SymbolString = SYMBOL_ERROR, ContentString = sb.ToString(), PrimaryButtonText = "DialogDismiss".GetLocalized(), Title = "DialogError".GetLocalized(), }; await dialog.ShowAsync(); }