Closed jskeet closed 1 year ago
@jskeet Sorry for the slow reply. That is an interesting ask. I assume you are using one of the UI components? Which one are you using?
Currently I'm just using DiffViewer
:
<Window x:Class="AtYourService.CloudStorage.InternalDiffDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:diffplex="clr-namespace:DiffPlex.Wpf.Controls;assembly=DiffPlex.Wpf"
mc:Ignorable="d"
Title="Diff" Height="450" Width="800">
<diffplex:DiffViewer IsSideBySide="True" OldTextHeader="Cloud file" NewTextHeader="Local file"
IgnoreCase="False" IgnoreWhiteSpace="False"
OldText="{Binding OldText}" NewText="{Binding NewText}"
x:Name="viewer" />
</Window>
@kingcean did much of the work here. I don't think the functionality is there today but seems reasonable.
@kingcean curious on how much work you think it is and how you would approach it
Hi @jskeet next/previous (and also go-to) commands are available in DiffWindow
currently now. You can show the window by following sample.
DiffWindow win = new();
win.OldText = oldText;
win.NewText = newText;
win.Show();
But no such functionality to use the DiffViewer
element in your control/page/window. I will bring it there soon so you can set property IsCommandBarVisible
as true
to enable the default UI or call PreviewDiff
/NextDiff
method.
Thanks - will have a look. For my particular use case I really don't want "Open file" or (probably) "Switch mode" - but it's possible that this information will be enough for me to implement the necessary bits anyway. Will have a look. Thanks so much for replying :)
Having looked at the DiffWindow code more closely, it turned out to be easy.
The "move to next diff" and "move to previous" diff could probably be moved from DiffWindow to DiffViewer (and exposed publicly) very easily, which would be somewhat useful for me to avoid the code duplication, but I have all the functionality I need now.
Thanks so much :)
I won't close this issue now in case you want to leave it as a prompt to move the code, but feel free to close it if you don't want to do the move.
Hi @jskeet #107 has moved these methods into DiffViewer
class.
Hi @mmanela could you please upload the packages to NuGet? I have attached them in the PR and you can find them in the last line of the description.
@kingcean: That's fabulous, thank you :)
Will look forward to updating the NuGet package, but it's really not urgent!
@jskeet @kingcean I uploaded the new package! Thanks for the suggestion @jskeet and thanks for the quick work @kingcean
I'm using DiffPlex to show side-by-side differences in config files to a non-technical audience. I'd love to be able to have "next" and "previous" buttons to jump between differences. I can't see anything supporting this, but I may have just missed it.
Is it already actually available - and if not, would it be difficult to add?