From 2f25e6387c5931cb9b51cae45d939159f4d26005 Mon Sep 17 00:00:00 2001 From: Fernando <2480661+fernandreu@users.noreply.github.com> Date: Sun, 28 Jul 2019 18:22:59 +0100 Subject: [PATCH] Add header to results panel --- .../Interfaces/IResultCollection.cs | 2 ++ OfficeRibbonXEditor/Models/FindResults.cs | 2 ++ OfficeRibbonXEditor/Models/XmlErrorResults.cs | 2 ++ OfficeRibbonXEditor/Views/MainWindow.xaml | 23 +++++++++++-------- OfficeRibbonXEditor/Views/MainWindow.xaml.cs | 1 + .../ViewModels/MainWindowViewModelTests.cs | 3 +++ 6 files changed, 23 insertions(+), 10 deletions(-) diff --git a/OfficeRibbonXEditor/Interfaces/IResultCollection.cs b/OfficeRibbonXEditor/Interfaces/IResultCollection.cs index a7c76b8d..1c6570fe 100644 --- a/OfficeRibbonXEditor/Interfaces/IResultCollection.cs +++ b/OfficeRibbonXEditor/Interfaces/IResultCollection.cs @@ -4,6 +4,8 @@ namespace OfficeRibbonXEditor.Interfaces { public interface IResultCollection { + string Header { get; } + void AddToPanel(Scintilla editor, Scintilla resultsPanel); void GoToPosition(int pos, Scintilla editor, Scintilla resultsPanel); diff --git a/OfficeRibbonXEditor/Models/FindResults.cs b/OfficeRibbonXEditor/Models/FindResults.cs index fbdc01ec..31addbc8 100644 --- a/OfficeRibbonXEditor/Models/FindResults.cs +++ b/OfficeRibbonXEditor/Models/FindResults.cs @@ -12,6 +12,8 @@ public FindResults(IEnumerable items) this.Items = new List(items); } + public string Header { get; } = "Find Results"; + public List Items { get; } public void AddToPanel(Scintilla editor, Scintilla resultsPanel) diff --git a/OfficeRibbonXEditor/Models/XmlErrorResults.cs b/OfficeRibbonXEditor/Models/XmlErrorResults.cs index e348ec55..228e2d46 100644 --- a/OfficeRibbonXEditor/Models/XmlErrorResults.cs +++ b/OfficeRibbonXEditor/Models/XmlErrorResults.cs @@ -13,6 +13,8 @@ public XmlErrorResults(IEnumerable items) this.Items = new List(items); } + public string Header { get; } = "XML Validation Results"; + public List Items { get; } public void AddToPanel(Scintilla editor, Scintilla resultsPanel) diff --git a/OfficeRibbonXEditor/Views/MainWindow.xaml b/OfficeRibbonXEditor/Views/MainWindow.xaml index 052d0946..a023651d 100644 --- a/OfficeRibbonXEditor/Views/MainWindow.xaml +++ b/OfficeRibbonXEditor/Views/MainWindow.xaml @@ -511,16 +511,19 @@ ResizeBehavior="PreviousAndNext"/> - + + diff --git a/OfficeRibbonXEditor/Views/MainWindow.xaml.cs b/OfficeRibbonXEditor/Views/MainWindow.xaml.cs index 89432e74..c71fadc8 100644 --- a/OfficeRibbonXEditor/Views/MainWindow.xaml.cs +++ b/OfficeRibbonXEditor/Views/MainWindow.xaml.cs @@ -76,6 +76,7 @@ protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs arg { this.ResultsSplitter.Visibility = Visibility.Visible; this.ResultsRow.Height = this.lastResultsHeight; + this.ResultsHeader.Content = e.Data.Header; this.ResultsPanel.UpdateFindAllResults(e.Data); }; } diff --git a/OfficeRibbonXEditorTests/ViewModels/MainWindowViewModelTests.cs b/OfficeRibbonXEditorTests/ViewModels/MainWindowViewModelTests.cs index 103ac239..d512c08f 100644 --- a/OfficeRibbonXEditorTests/ViewModels/MainWindowViewModelTests.cs +++ b/OfficeRibbonXEditorTests/ViewModels/MainWindowViewModelTests.cs @@ -278,6 +278,9 @@ public void RemoveIconWarningTest() this.AssertMessage(this.viewModel.CloseDocumentCommand.Execute, MessageBoxImage.Warning, MessageBoxResult.Cancel); } + /// + /// Checks if the XML validation provides the expected result for a few sample cases + /// [Test] public void XmlValidationTest() {