Index: Core/Gui/src/Core.Gui/Forms/Backstage/InfoViewModel.cs
===================================================================
diff -u -r236b163b834acf89b5bb83c0f0c689ea723ec134 -rddd1c988761760ebc4ddc892a64960ec4537f717
--- Core/Gui/src/Core.Gui/Forms/Backstage/InfoViewModel.cs (.../InfoViewModel.cs) (revision 236b163b834acf89b5bb83c0f0c689ea723ec134)
+++ Core/Gui/src/Core.Gui/Forms/Backstage/InfoViewModel.cs (.../InfoViewModel.cs) (revision ddd1c988761760ebc4ddc892a64960ec4537f717)
@@ -19,15 +19,41 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+
namespace Core.Gui.Forms.Backstage
{
///
/// ViewModel for .
///
- public class InfoViewModel : IBackstagePageViewModel
+ public class InfoViewModel : IBackstagePageViewModel, INotifyPropertyChanged
{
- public string ProjectName => "Project";
+ private string projectName;
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ ///
+ /// Gets the name of the project.
+ ///
+ public string ProjectName
+ {
+ get => projectName;
+ set
+ {
+ projectName = value;
+ OnPropertyChanged(nameof(ProjectName));
+ }
+ }
+
+ ///
+ /// Gets the name of the assessment section.
+ ///
public string AssessmentSectionName => "Traject 12-2";
+
+ protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
+ {
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ }
}
}
\ No newline at end of file
Index: Core/Gui/src/Core.Gui/GuiCore.cs
===================================================================
diff -u -r6f2f24378f372a8b22b5e5fa2b6987a804e3f7f6 -rddd1c988761760ebc4ddc892a64960ec4537f717
--- Core/Gui/src/Core.Gui/GuiCore.cs (.../GuiCore.cs) (revision 6f2f24378f372a8b22b5e5fa2b6987a804e3f7f6)
+++ Core/Gui/src/Core.Gui/GuiCore.cs (.../GuiCore.cs) (revision ddd1c988761760ebc4ddc892a64960ec4537f717)
@@ -250,7 +250,7 @@
isExiting = true;
- mainWindow?.UnsubscribeFromGui();
+ mainWindow.UnsubscribeFromGui();
Selection = null;
@@ -367,11 +367,12 @@
private void ApplicationProjectOpened(IProject newProject)
{
- mainWindow?.ValidateItems();
+ mainWindow.ValidateItems();
projectObserver.Observable = newProject;
UpdateTitle();
- mainWindow?.UpdateProjectExplorer();
+ mainWindow.UpdateProjectExplorer();
+ mainWindow.BackstageViewModel.InfoViewModel.ProjectName = project.Name;
}
private void ApplicationBeforeProjectOpened(IProject oldProject)
Index: Core/Gui/test/Core.Gui.Test/Forms/Backstage/BackstageViewModelTest.cs
===================================================================
diff -u -r2ccd820a20c579a55a3752d370c30781624e6dee -rddd1c988761760ebc4ddc892a64960ec4537f717
--- Core/Gui/test/Core.Gui.Test/Forms/Backstage/BackstageViewModelTest.cs (.../BackstageViewModelTest.cs) (revision 2ccd820a20c579a55a3752d370c30781624e6dee)
+++ Core/Gui/test/Core.Gui.Test/Forms/Backstage/BackstageViewModelTest.cs (.../BackstageViewModelTest.cs) (revision ddd1c988761760ebc4ddc892a64960ec4537f717)
@@ -23,13 +23,9 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Reflection;
-using Core.Common.Base.Data;
-using Core.Common.Base.Storage;
using Core.Gui.Forms.Backstage;
using Core.Gui.Settings;
-using Core.Gui.TestUtil;
using NUnit.Framework;
-using Rhino.Mocks;
namespace Core.Gui.Test.Forms.Backstage
{
@@ -64,6 +60,7 @@
Assert.IsInstanceOf(viewModel);
Assert.IsNotNull(viewModel.InfoViewModel);
+ Assert.IsNull(viewModel.InfoViewModel.ProjectName);
Assert.IsNotNull(viewModel.AboutViewModel);
Assert.AreEqual(settings.MainWindowTitle, viewModel.AboutViewModel.ApplicationName);
Index: Core/Gui/test/Core.Gui.Test/Forms/Backstage/InfoViewModelTest.cs
===================================================================
diff -u -r236b163b834acf89b5bb83c0f0c689ea723ec134 -rddd1c988761760ebc4ddc892a64960ec4537f717
--- Core/Gui/test/Core.Gui.Test/Forms/Backstage/InfoViewModelTest.cs (.../InfoViewModelTest.cs) (revision 236b163b834acf89b5bb83c0f0c689ea723ec134)
+++ Core/Gui/test/Core.Gui.Test/Forms/Backstage/InfoViewModelTest.cs (.../InfoViewModelTest.cs) (revision ddd1c988761760ebc4ddc892a64960ec4537f717)
@@ -19,6 +19,7 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System.ComponentModel;
using Core.Gui.Forms.Backstage;
using NUnit.Framework;
@@ -35,8 +36,9 @@
// Assert
Assert.IsInstanceOf(viewModel);
+ Assert.IsInstanceOf(viewModel);
+ Assert.IsNull(viewModel.ProjectName);
- Assert.AreEqual("Project", viewModel.ProjectName);
Assert.AreEqual("Traject 12-2", viewModel.AssessmentSectionName);
}
}