Index: Core/Gui/src/Core.Gui/Forms/Backstage/InfoBackstagePage.xaml =================================================================== diff -u -r532727d43f51643ec903a025f20afb5e67f3b048 -r524febc6db4d42193289c6d006e242fbe0ededdf --- Core/Gui/src/Core.Gui/Forms/Backstage/InfoBackstagePage.xaml (.../InfoBackstagePage.xaml) (revision 532727d43f51643ec903a025f20afb5e67f3b048) +++ Core/Gui/src/Core.Gui/Forms/Backstage/InfoBackstagePage.xaml (.../InfoBackstagePage.xaml) (revision 524febc6db4d42193289c6d006e242fbe0ededdf) @@ -33,6 +33,7 @@ + @@ -42,13 +43,33 @@ - - + @@ -74,6 +95,7 @@ + + + + Index: Core/Gui/src/Core.Gui/Forms/Backstage/InfoViewModel.cs =================================================================== diff -u -rddd1c988761760ebc4ddc892a64960ec4537f717 -r524febc6db4d42193289c6d006e242fbe0ededdf --- Core/Gui/src/Core.Gui/Forms/Backstage/InfoViewModel.cs (.../InfoViewModel.cs) (revision ddd1c988761760ebc4ddc892a64960ec4537f717) +++ Core/Gui/src/Core.Gui/Forms/Backstage/InfoViewModel.cs (.../InfoViewModel.cs) (revision 524febc6db4d42193289c6d006e242fbe0ededdf) @@ -19,8 +19,10 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; using System.ComponentModel; using System.Runtime.CompilerServices; +using Core.Common.Base.Data; namespace Core.Gui.Forms.Backstage { @@ -29,28 +31,54 @@ /// public class InfoViewModel : IBackstagePageViewModel, INotifyPropertyChanged { - private string projectName; + private IProject project; public event PropertyChangedEventHandler PropertyChanged; /// - /// Gets the name of the project. + /// Gets or sets the name of the project. /// public string ProjectName { - get => projectName; + get => project?.Name; set { - projectName = value; + project.Name = value; OnPropertyChanged(nameof(ProjectName)); } } /// - /// Gets the name of the assessment section. + /// Gets or sets the description of the project. /// - public string AssessmentSectionName => "Traject 12-2"; + public string ProjectDescription + { + get => project?.Description; + set + { + project.Description = value; + OnPropertyChanged(nameof(ProjectDescription)); + } + } + /// + /// Sets the project. + /// + /// The project to set. + /// Thrown when + /// is null + public void SetProject(IProject projectToSet) + { + if (projectToSet == null) + { + throw new ArgumentNullException(nameof(projectToSet)); + } + + project = projectToSet; + OnPropertyChanged(nameof(ProjectName)); + OnPropertyChanged(nameof(ProjectDescription)); + } + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); Index: Core/Gui/src/Core.Gui/GuiCore.cs =================================================================== diff -u -r039805634cdeb409848180842045be21d3af12c0 -r524febc6db4d42193289c6d006e242fbe0ededdf --- Core/Gui/src/Core.Gui/GuiCore.cs (.../GuiCore.cs) (revision 039805634cdeb409848180842045be21d3af12c0) +++ Core/Gui/src/Core.Gui/GuiCore.cs (.../GuiCore.cs) (revision 524febc6db4d42193289c6d006e242fbe0ededdf) @@ -145,7 +145,7 @@ ProjectOpened += ApplicationProjectOpened; BeforeProjectOpened += ApplicationBeforeProjectOpened; - projectObserver = new Observer(UpdateTitle); + projectObserver = new Observer(UpdateProjectData); Project = projectFactory.CreateNewProject(); } @@ -370,7 +370,7 @@ mainWindow.ValidateItems(); projectObserver.Observable = newProject; - UpdateTitle(); + UpdateProjectData(); mainWindow.UpdateProjectExplorer(); } @@ -497,7 +497,7 @@ mainWindow.SubscribeToGui(); - UpdateTitle(); + UpdateProjectData(); } private void OnViewClosed(object sender, ViewChangeEventArgs e) @@ -779,15 +779,15 @@ } } - private void UpdateTitle() + private void UpdateProjectData() { mainWindow.Title = string.Format(CultureInfo.CurrentCulture, "{0} - {1} {2}", Project.Name, FixedSettings.MainWindowTitle, SettingsHelper.Instance.ApplicationVersion); - mainWindow.BackstageViewModel.InfoViewModel.ProjectName = project.Name; + mainWindow.BackstageViewModel.InfoViewModel.SetProject(project); } #endregion Index: Core/Gui/src/Core.Gui/Properties/Resources.Designer.cs =================================================================== diff -u -r532727d43f51643ec903a025f20afb5e67f3b048 -r524febc6db4d42193289c6d006e242fbe0ededdf --- Core/Gui/src/Core.Gui/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 532727d43f51643ec903a025f20afb5e67f3b048) +++ Core/Gui/src/Core.Gui/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 524febc6db4d42193289c6d006e242fbe0ededdf) @@ -804,6 +804,15 @@ } /// + /// Looks up a localized string similar to Omschrijving. + /// + public static string Description_DisplayName { + get { + return ResourceManager.GetString("Description_DisplayName", resourceCulture); + } + } + + /// /// Looks up a localized string similar to DynamicPropertyOrderEvaluationMethod heeft een incorrect aantal argumenten. Zou er één moeten zijn. Klasse: {0}.. /// public static string DynamicPropertyOrderEvaluationMethod_incorrect_argument_count_must_be_one_string_argument_on_Class_0_ { Index: Core/Gui/src/Core.Gui/Properties/Resources.resx =================================================================== diff -u -r532727d43f51643ec903a025f20afb5e67f3b048 -r524febc6db4d42193289c6d006e242fbe0ededdf --- Core/Gui/src/Core.Gui/Properties/Resources.resx (.../Resources.resx) (revision 532727d43f51643ec903a025f20afb5e67f3b048) +++ Core/Gui/src/Core.Gui/Properties/Resources.resx (.../Resources.resx) (revision 524febc6db4d42193289c6d006e242fbe0ededdf) @@ -993,4 +993,7 @@ Email Support + + Omschrijving + \ No newline at end of file Index: Core/Gui/test/Core.Gui.Test/Forms/Backstage/InfoViewModelTest.cs =================================================================== diff -u -rddd1c988761760ebc4ddc892a64960ec4537f717 -r524febc6db4d42193289c6d006e242fbe0ededdf --- Core/Gui/test/Core.Gui.Test/Forms/Backstage/InfoViewModelTest.cs (.../InfoViewModelTest.cs) (revision ddd1c988761760ebc4ddc892a64960ec4537f717) +++ Core/Gui/test/Core.Gui.Test/Forms/Backstage/InfoViewModelTest.cs (.../InfoViewModelTest.cs) (revision 524febc6db4d42193289c6d006e242fbe0ededdf) @@ -19,9 +19,12 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; using System.ComponentModel; +using Core.Common.Base.Data; using Core.Gui.Forms.Backstage; using NUnit.Framework; +using Rhino.Mocks; namespace Core.Gui.Test.Forms.Backstage { @@ -38,8 +41,43 @@ Assert.IsInstanceOf(viewModel); Assert.IsInstanceOf(viewModel); Assert.IsNull(viewModel.ProjectName); + Assert.IsNull(viewModel.ProjectDescription); + } + + [Test] + public void SetProject_ProjectNull_ThrowsArgumentNullException() + { + // Setup + var viewModel = new InfoViewModel(); - Assert.AreEqual("Traject 12-2", viewModel.AssessmentSectionName); + // Call + void Call() => viewModel.SetProject(null); + + // Assert + var exception = Assert.Throws(Call); + Assert.AreEqual("projectToSet", exception.ParamName); } + + [Test] + public void SetProject_WithProject_ExpectedValues() + { + // Setup + var mocks = new MockRepository(); + var project = mocks.Stub(); + mocks.ReplayAll(); + + project.Name = "Test"; + project.Description = "Test description"; + + var viewModel = new InfoViewModel(); + + // Call + viewModel.SetProject(project); + + // Assert + Assert.AreEqual(project.Name, viewModel.ProjectName); + Assert.AreEqual(project.Description, viewModel.ProjectDescription); + mocks.VerifyAll(); + } } } \ No newline at end of file