public async override Task <bool> CanNavigateAsync(IConfirmNavigationParameters parameters) { if (parameters.GoingTo(typeof(Views.DetailPage))) { return(await _dialogService.AreYouSureAsync()); } else { return(true); } }
public async override Task <bool> CanNavigateAsync(IConfirmNavigationParameters parameters) { if (parameters.ToNavigationInfo.PageType == typeof(Views.DetailPage)) { var prompt = _resourceService.TryGetLocalizedString("AreYouSure", out var value) ? value : "Are you sure?"; return(await _dialogService.PromptAsync(prompt, MessageBoxType.YesNo, MessageBoxResult.Yes)); } else { return(true); } }
public async override Task <bool> CanNavigateAsync(IConfirmNavigationParameters parameters) { var goingToDetails = parameters.ToNavigationInfo.PageType == typeof(Views.DetailPage); if (goingToDetails) { var dialog = new ContentDialog { Title = "Confirmation", Content = "Are you sure?", PrimaryButtonText = "Continue", SecondaryButtonText = "Cancel", }; var result = await dialog.ShowAsyncEx(); return(result != ContentDialogResult.Secondary); } else { return(true); } }
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously public async virtual Task <bool> CanNavigateAsync(IConfirmNavigationParameters parameters) => true;
public async virtual Task <bool> CanNavigateAsync(IConfirmNavigationParameters parameters) { await Task.CompletedTask; return(true); }
public async override Task <bool> CanNavigateAsync(IConfirmNavigationParameters parameters) { var result = await _DialogService.PromptAsync("Are you sure?"); return(result == MessageBoxResult.Yes); }