private async void TblErrorFiles_PointerReleased(object sender, PointerRoutedEventArgs e) { IList <ErrorFilePair> pairs = (IList <ErrorFilePair>)((FrameworkElement)sender).DataContext; if (pairs.Count == 0) { await DialogUtils.ShowSafeAsync("<none>", "Errors"); return; } int i = 0; while (true) { ErrorFilePair errorPair = pairs[i]; string title = $"Error: {i + 1} / {pairs.Count}"; string message = $"{errorPair.Pair.RelativePath}\r\n{errorPair.Exception}"; ContentDialogResult result = await DialogUtils.ShowContentAsync(message, title, "Cancel", "Previous", "Next", ContentDialogButton.Secondary); if (result == ContentDialogResult.Primary) { i = StdUtils.OffsetIndex(i, pairs.Count, -1).index; } else if (result == ContentDialogResult.Secondary) { i = StdUtils.OffsetIndex(i, pairs.Count, 1).index; } else { break; } } }
private async void AbbNewFolder_Click(object sender, RoutedEventArgs e) { string name = "New Folder"; while (true) { TextBox tbx = new TextBox() { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Top, Text = name, }; tbx.SelectAll(); ContentDialogResult result = await DialogUtils.ShowContentAsync(tbx, "Name:", "Cancel", "Create"); if (result != ContentDialogResult.Primary) { break; } name = tbx.Text.Trim(); if (name.Length == 0 || name.Any(c => Path.GetInvalidFileNameChars().Contains(c))) { continue; } string path = Utils.JoinPaths(pcView.CurrentFolder.Value.FullPath, name); await UiUtils.TryAgain("Try again?", "Create folder error", () => viewModel.Api.CreateFolder(path), viewModel.BackgroundOperations, "Create folder..."); await pcView.UpdateCurrentFolderItems(); break; } }