Index: Application/Application.Ringtoets/App.xaml.cs =================================================================== diff -u -r5e95cef28d34afb7f3461eb208ec3f55c307cf47 -rd121feba5299c86d7ac04a366ee869b163e43ec7 --- Application/Application.Ringtoets/App.xaml.cs (.../App.xaml.cs) (revision 5e95cef28d34afb7f3461eb208ec3f55c307cf47) +++ Application/Application.Ringtoets/App.xaml.cs (.../App.xaml.cs) (revision d121feba5299c86d7ac04a366ee869b163e43ec7) @@ -109,15 +109,15 @@ { if (runActivity != null) { - if (gui.ApplicationCore.Project == null) + if (gui.Project == null) { log.ErrorFormat(Core.Common.Gui.Properties.Resources.App_RunRingtoets_No_project_found_load_project_first); return; } // search project for activities specified by the argument var activity = - gui.ApplicationCore.Project.Items + gui.Project.Items .OfType() .FirstOrDefault(a => a.Name == runActivity); if (activity == null) @@ -132,9 +132,9 @@ gui.ApplicationCore.RunActivity(activity); log.InfoFormat(Core.Common.Gui.Properties.Resources.App_RunRingtoets_Activity_0_ended_with_status_1_, runActivity, activity.Status); - log.InfoFormat(Core.Common.Gui.Properties.Resources.App_RunRingtoets_Saving_project_0_, gui.ApplicationCore.Project.Name); + log.InfoFormat(Core.Common.Gui.Properties.Resources.App_RunRingtoets_Saving_project_0_, gui.Project.Name); gui.ApplicationCore.SaveProject(); - log.InfoFormat(Core.Common.Gui.Properties.Resources.App_RunRingtoets_Saved_project_0_, gui.ApplicationCore.Project.Name); + log.InfoFormat(Core.Common.Gui.Properties.Resources.App_RunRingtoets_Saved_project_0_, gui.Project.Name); } }; Index: Core/Common/src/Core.Common.Base/ApplicationCore.cs =================================================================== diff -u -r7b4f672be7e2d4eb74d7b7f7a88538b3f586d57c -rd121feba5299c86d7ac04a366ee869b163e43ec7 --- Core/Common/src/Core.Common.Base/ApplicationCore.cs (.../ApplicationCore.cs) (revision 7b4f672be7e2d4eb74d7b7f7a88538b3f586d57c) +++ Core/Common/src/Core.Common.Base/ApplicationCore.cs (.../ApplicationCore.cs) (revision d121feba5299c86d7ac04a366ee869b163e43ec7) @@ -5,16 +5,13 @@ using System.Linq; using Core.Common.Base.Workflow; using Core.Common.Utils; -using Core.Common.Utils.Aop; using Core.Common.Utils.Globalization; namespace Core.Common.Base { public class ApplicationCore : IDisposable { // TODO: migrate into ProjectService - public event Action ProjectOpened; - public event Action ProjectClosing; public event Action ProjectSaving; public event Action ProjectSaveFailed; public event Action ProjectSaved; @@ -43,36 +40,6 @@ } } - public Project Project - { - get - { - return project; - } - - [InvokeRequired] - set - { - if (project != null) - { - if (ProjectClosing != null) - { - ProjectClosing(project); - } - } - - project = value; - - if (project != null) - { - if (ProjectOpened != null) - { - ProjectOpened(project); - } - } - } - } - public IEnumerable Plugins { get @@ -161,11 +128,6 @@ applicationPlugin.Deactivate(); } - public void CloseProject() - { - Project = null; - } - public void SaveProjectAs(string path) { // TODO: implement @@ -178,11 +140,6 @@ public void Exit() { - if (Project != null) - { - CloseProject(); - } - if (userSettings.IsDirty) { UserSettings.Save(); @@ -228,8 +185,6 @@ public void Dispose() { - CloseProject(); - foreach (var plugin in Plugins.ToList()) { RemovePlugin(plugin); Index: Core/Common/src/Core.Common.Gui/Forms/MainWindow/MainWindow.xaml.cs =================================================================== diff -u -r48fe36c87dd40ff715adf4c0cf393f7390e6c993 -rd121feba5299c86d7ac04a366ee869b163e43ec7 --- Core/Common/src/Core.Common.Gui/Forms/MainWindow/MainWindow.xaml.cs (.../MainWindow.xaml.cs) (revision 48fe36c87dd40ff715adf4c0cf393f7390e6c993) +++ Core/Common/src/Core.Common.Gui/Forms/MainWindow/MainWindow.xaml.cs (.../MainWindow.xaml.cs) (revision d121feba5299c86d7ac04a366ee869b163e43ec7) @@ -650,7 +650,7 @@ ButtonShowProperties.IsChecked = Gui.ToolWindowViews.Contains(PropertyGrid); } - var appHasProject = (Gui.ApplicationCore.Project != null); + var appHasProject = Gui.Project != null; var isActivityRunning = Gui.ApplicationCore.IsActivityRunning(); // filemenu items dependent on existence of project and if processes are running Index: Core/Common/src/Core.Common.Gui/GuiCommandHandler.cs =================================================================== diff -u -r860e9e6db2d492ba8f50993af49f9e6b2cffeac1 -rd121feba5299c86d7ac04a366ee869b163e43ec7 --- Core/Common/src/Core.Common.Gui/GuiCommandHandler.cs (.../GuiCommandHandler.cs) (revision 860e9e6db2d492ba8f50993af49f9e6b2cffeac1) +++ Core/Common/src/Core.Common.Gui/GuiCommandHandler.cs (.../GuiCommandHandler.cs) (revision d121feba5299c86d7ac04a366ee869b163e43ec7) @@ -34,8 +34,8 @@ { this.gui = gui; - this.gui.ApplicationCore.ProjectOpened += ApplicationProjectOpened; - this.gui.ApplicationCore.ProjectClosing += ApplicationProjectClosing; + this.gui.ProjectOpened += ApplicationProjectOpened; + this.gui.ProjectClosing += ApplicationProjectClosing; guiImportHandler = CreateGuiImportHandler(); guiExportHandler = CreateGuiExportHandler(); @@ -50,7 +50,7 @@ } Log.Info(Resources.Opening_new_project); - gui.ApplicationCore.Project = new Project(); + gui.Project = new Project(); Log.Info(Resources.New_project_successfully_opened); RefreshGui(); @@ -87,7 +87,7 @@ var result = false; // TODO: Implement logic for opening the project from the provided file path - ProgressBarDialog.PerformTask(Resources.Loading_project_from_selected_file, () => gui.ApplicationCore.Project = new Project()); + ProgressBarDialog.PerformTask(Resources.Loading_project_from_selected_file, () => gui.Project = new Project()); RefreshGui(); @@ -96,7 +96,7 @@ public bool TryCloseProject() { - if (gui.ApplicationCore.Project != null) + if (gui.Project != null) { Log.Info(Resources.GuiCommandHandler_TryCloseProject_Closing_current_project); @@ -105,10 +105,10 @@ // remove views before closing project. if (!ViewList.DoNotDisposeViewsOnRemove) { - RemoveAllViewsForItem(gui.ApplicationCore.Project); + RemoveAllViewsForItem(gui.Project); } - gui.ApplicationCore.CloseProject(); + gui.Project = null; RefreshGui(); @@ -232,7 +232,7 @@ public void AddNewItem(object parent) { - if (gui.ApplicationCore.Project == null) + if (gui.Project == null) { Log.Error(Resources.GuiCommandHandler_AddNewItem_There_needs_to_be_a_project_to_add_an_item); } @@ -291,8 +291,8 @@ public void Dispose() { - gui.ApplicationCore.ProjectOpened -= ApplicationProjectOpened; - gui.ApplicationCore.ProjectClosing -= ApplicationProjectClosing; + gui.ProjectOpened -= ApplicationProjectOpened; + gui.ProjectClosing -= ApplicationProjectClosing; } private GuiImportHandler CreateGuiImportHandler() @@ -436,8 +436,8 @@ public void AddItemToProject(object newItem) { - gui.ApplicationCore.Project.Items.Add(newItem); - gui.ApplicationCore.Project.NotifyObservers(); + gui.Project.Items.Add(newItem); + gui.Project.NotifyObservers(); } [InvokeRequired] @@ -453,7 +453,7 @@ [InvokeRequired] private void RefreshGui() { - var project = gui.ApplicationCore.Project; + var project = gui.Project; // Set the gui selection to the current project gui.Selection = project; Index: Core/Common/src/Core.Common.Gui/IGui.cs =================================================================== diff -u -r48fe36c87dd40ff715adf4c0cf393f7390e6c993 -rd121feba5299c86d7ac04a366ee869b163e43ec7 --- Core/Common/src/Core.Common.Gui/IGui.cs (.../IGui.cs) (revision 48fe36c87dd40ff715adf4c0cf393f7390e6c993) +++ Core/Common/src/Core.Common.Gui/IGui.cs (.../IGui.cs) (revision d121feba5299c86d7ac04a366ee869b163e43ec7) @@ -17,6 +17,13 @@ /// public interface IGui { + #region Public properties + + event Action ProjectOpened; + event Action ProjectClosing; + + #endregion + #region Public Properties /// @@ -25,6 +32,11 @@ ApplicationCore ApplicationCore { get; set; } /// + /// Gets or sets the project of the . + /// + Project Project { get; set; } + + /// /// Gets or sets CommandHandler. /// IGuiCommandHandler CommandHandler { get; set; } Index: Core/Common/src/Core.Common.Gui/RingtoetsGui.cs =================================================================== diff -u -r860e9e6db2d492ba8f50993af49f9e6b2cffeac1 -rd121feba5299c86d7ac04a366ee869b163e43ec7 --- Core/Common/src/Core.Common.Gui/RingtoetsGui.cs (.../RingtoetsGui.cs) (revision 860e9e6db2d492ba8f50993af49f9e6b2cffeac1) +++ Core/Common/src/Core.Common.Gui/RingtoetsGui.cs (.../RingtoetsGui.cs) (revision d121feba5299c86d7ac04a366ee869b163e43ec7) @@ -7,7 +7,6 @@ using System.Diagnostics; using System.Linq; using System.Reflection; -using System.Resources; using Core.Common.Base; using Core.Common.Base.Workflow; using Core.Common.Controls; @@ -58,7 +57,11 @@ private bool settingSelection; private bool runFinished; private bool isExiting; + private Project project; + public event Action ProjectOpened; + public event Action ProjectClosing; + public RingtoetsGui() { // error detection code, make sure we use only a single instance of RingtoetsGui at a time @@ -81,6 +84,9 @@ CommandHandler = new GuiCommandHandler(this); System.Windows.Forms.Application.EnableVisualStyles(); + + ProjectClosing += ApplicationProjectClosing; + ProjectOpened += ApplicationProjectOpened; } public bool SkipDialogsOnExit { get; set; } @@ -97,8 +103,6 @@ { if (applicationCore != null) { - ApplicationCore.ProjectClosing -= ApplicationProjectClosing; - ApplicationCore.ProjectOpened -= ApplicationProjectOpened; ApplicationCore.ProjectSaved -= ApplicationProjectSaved; ApplicationCore.ActivityRunner.IsRunningChanged -= ActivityRunnerIsRunningChanged; ApplicationCore.ActivityRunner.ActivityCompleted -= ActivityRunnerActivityCompleted; @@ -109,15 +113,41 @@ if (applicationCore != null) { // subscribe to application events so that we can handle opening, closing, renamig of views on project changes - ApplicationCore.ProjectClosing += ApplicationProjectClosing; - ApplicationCore.ProjectOpened += ApplicationProjectOpened; ApplicationCore.ProjectSaved += ApplicationProjectSaved; ApplicationCore.ActivityRunner.IsRunningChanged += ActivityRunnerIsRunningChanged; ApplicationCore.ActivityRunner.ActivityCompleted += ActivityRunnerActivityCompleted; } } } + public Project Project + { + get + { + return project; + } + set + { + if (project != null) + { + if (ProjectClosing != null) + { + ProjectClosing(project); + } + } + + project = value; + + if (project != null) + { + if (ProjectOpened != null) + { + ProjectOpened(project); + } + } + } + } + public object Selection { get @@ -232,13 +262,13 @@ if (!string.IsNullOrEmpty(projectPath)) { // TODO: Implement logic for opening the project from the provided file path - applicationCore.Project = new Project(); + Project = new Project(); } else { log.Info(Resources.RingtoetsGui_Run_Starting_application); - applicationCore.Project = new Project(); + Project = new Project(); } log.Info(Resources.RingtoetsGui_Run_Initializing_graphical_user_interface); @@ -335,11 +365,12 @@ System.Windows.Forms.Application.DoEvents(); } } - ApplicationCore.CloseProject(); // lots of unsubscribe logic in plugins reacts on this } } finally { + Project = null; + if (ToolWindowViews != null) { ToolWindowViews.Clear(); @@ -779,9 +810,9 @@ string mainWindowTitle = ApplicationCore.Settings["mainWindowTitle"]; string projectTitle = ""; - if (ApplicationCore.Project != null) + if (Project != null) { - projectTitle = ApplicationCore.Project.Name; + projectTitle = Project.Name; } // TODO: this must be moved to MainWindow which should listen to project changes Index: Core/Common/test/Core.Common.Integration.Tests/Ringtoets/Application.Ringtoets/RingtoetsGuiIntegrationTest.cs =================================================================== diff -u -rcaeb44054bb58aa8c480f86e7922a60ecf0f08ef -rd121feba5299c86d7ac04a366ee869b163e43ec7 --- Core/Common/test/Core.Common.Integration.Tests/Ringtoets/Application.Ringtoets/RingtoetsGuiIntegrationTest.cs (.../RingtoetsGuiIntegrationTest.cs) (revision caeb44054bb58aa8c480f86e7922a60ecf0f08ef) +++ Core/Common/test/Core.Common.Integration.Tests/Ringtoets/Application.Ringtoets/RingtoetsGuiIntegrationTest.cs (.../RingtoetsGuiIntegrationTest.cs) (revision d121feba5299c86d7ac04a366ee869b163e43ec7) @@ -144,7 +144,7 @@ gui.Run(); - Action onShown = () => TestHelper.AssertIsFasterThan(300, () => gui.ApplicationCore.Project = new Project()); + Action onShown = () => TestHelper.AssertIsFasterThan(300, () => gui.Project = new Project()); WpfTestHelper.ShowModal((Control) gui.MainWindow, onShown); } @@ -170,7 +170,7 @@ for (int i = 0; i < 20; i++) { var map = new Map(); - applicationCore.Project.Items.Add(map); + gui.Project.Items.Add(map); gui.CommandHandler.OpenView(map); } applicationCore.SaveProjectAs(TestHelper.GetCurrentMethodName() + ".dsproj"); @@ -188,7 +188,7 @@ gui.Plugins.Add(new ProjectExplorerGuiPlugin()); gui.Run(); - Assert.AreEqual(gui.ApplicationCore.Project, gui.Selection); + Assert.AreEqual(gui.Project, gui.Selection); } } @@ -211,8 +211,6 @@ { using (var gui = new RingtoetsGui()) { - var applicationCore = gui.ApplicationCore; - gui.Plugins.Add(new ProjectExplorerGuiPlugin()); gui.Run(); @@ -221,7 +219,7 @@ var treeView = projectExplorer.TreeView; treeView.SelectedNode = treeView.Nodes[0]; // project node - Assert.AreEqual(applicationCore.Project, gui.Selection); + Assert.AreEqual(gui.Project, gui.Selection); } } Index: Core/Common/test/Core.Common.Tests/Gui/ImportActivityTest.cs =================================================================== diff -u -r48fe36c87dd40ff715adf4c0cf393f7390e6c993 -rd121feba5299c86d7ac04a366ee869b163e43ec7 --- Core/Common/test/Core.Common.Tests/Gui/ImportActivityTest.cs (.../ImportActivityTest.cs) (revision 48fe36c87dd40ff715adf4c0cf393f7390e6c993) +++ Core/Common/test/Core.Common.Tests/Gui/ImportActivityTest.cs (.../ImportActivityTest.cs) (revision d121feba5299c86d7ac04a366ee869b163e43ec7) @@ -1,6 +1,5 @@ using Core.Common.Base; using Core.Common.Base.Workflow; -using Core.Common.Gui; using NUnit.Framework; using Rhino.Mocks; @@ -14,8 +13,6 @@ [Test] public void FileImportActivity() { - var gui = mockRepository.Stub(); - var project = new Project("test"); var importer = mockRepository.Stub(); @@ -35,13 +32,6 @@ mockRepository.ReplayAll(); - var applicationCore = new ApplicationCore - { - Project = project - }; - - gui.ApplicationCore = applicationCore; - // expect some reporting while processing each file fileImportActivity.OnImportFinished += (sender, importedObject, theImporter) => { @@ -52,7 +42,7 @@ fileImportActivity.Initialize(); fileImportActivity.Execute(); - Assert.AreEqual(3, applicationCore.Project.Items.Count); + Assert.AreEqual(3, project.Items.Count); mockRepository.VerifyAll(); } Index: Core/Plugins/src/Core.Plugins.CommonTools.Gui/CommonToolsGuiPlugin.cs =================================================================== diff -u -r7b4f672be7e2d4eb74d7b7f7a88538b3f586d57c -rd121feba5299c86d7ac04a366ee869b163e43ec7 --- Core/Plugins/src/Core.Plugins.CommonTools.Gui/CommonToolsGuiPlugin.cs (.../CommonToolsGuiPlugin.cs) (revision 7b4f672be7e2d4eb74d7b7f7a88538b3f586d57c) +++ Core/Plugins/src/Core.Plugins.CommonTools.Gui/CommonToolsGuiPlugin.cs (.../CommonToolsGuiPlugin.cs) (revision d121feba5299c86d7ac04a366ee869b163e43ec7) @@ -117,8 +117,6 @@ InitializeChartLegendView(); - Gui.ApplicationCore.ProjectClosing += ApplicationProjectClosing; - if (Gui != null && Gui.DocumentViews != null) { if (Gui.DocumentViews.ActiveView != null) @@ -241,8 +239,6 @@ Gui.MainWindow.ValidateItems(); } - private void ApplicationProjectClosing(Project project) {} - private void InitializeTableView() { if (tableViewInitialized) Index: Core/Plugins/src/Core.Plugins.ProjectExplorer/ProjectExplorerGuiPlugin.cs =================================================================== diff -u -r48fe36c87dd40ff715adf4c0cf393f7390e6c993 -rd121feba5299c86d7ac04a366ee869b163e43ec7 --- Core/Plugins/src/Core.Plugins.ProjectExplorer/ProjectExplorerGuiPlugin.cs (.../ProjectExplorerGuiPlugin.cs) (revision 48fe36c87dd40ff715adf4c0cf393f7390e6c993) +++ Core/Plugins/src/Core.Plugins.ProjectExplorer/ProjectExplorerGuiPlugin.cs (.../ProjectExplorerGuiPlugin.cs) (revision d121feba5299c86d7ac04a366ee869b163e43ec7) @@ -45,7 +45,7 @@ // todo redesign user settings to expand settings per plugin //var isSorted = Gui.ApplicationCore.Settings["IsProjectExplorerSorted"]; //projectExplorer.ProjectTreeView.IsSorted = (isSorted == null || bool.Parse(isSorted)); - ProjectExplorer.ProjectTreeView.Project = Gui.ApplicationCore.Project; + ProjectExplorer.ProjectTreeView.Project = Gui.Project; ProjectExplorer.Text = Properties.Resources.ProjectExplorerPluginGui_InitializeProjectTreeView_Project_Explorer; } @@ -61,8 +61,8 @@ InitializeProjectTreeView(); - Gui.ApplicationCore.ProjectOpened += ApplicationProjectOpened; - Gui.ApplicationCore.ProjectClosing += ApplicationProjectClosed; + Gui.ProjectOpened += ApplicationProjectOpened; + Gui.ProjectClosing += ApplicationProjectClosed; Gui.ApplicationCore.ProjectSaving += ApplicationOnProjectSaving; Gui.ApplicationCore.ProjectSaved += ApplicationProjectSaved; @@ -84,8 +84,8 @@ public override void Deactivate() { base.Deactivate(); - Gui.ApplicationCore.ProjectOpened -= ApplicationProjectOpened; - Gui.ApplicationCore.ProjectClosing -= ApplicationProjectClosed; + Gui.ProjectOpened -= ApplicationProjectOpened; + Gui.ProjectClosing -= ApplicationProjectClosed; Gui.ApplicationCore.ProjectSaving -= ApplicationOnProjectSaving; Gui.ApplicationCore.ProjectSaved -= ApplicationProjectSaved; Gui.ToolWindowViews.Remove(ProjectExplorer); Index: Core/Plugins/src/Core.Plugins.ProjectExplorer/ProjectTreeView.cs =================================================================== diff -u -r48fe36c87dd40ff715adf4c0cf393f7390e6c993 -rd121feba5299c86d7ac04a366ee869b163e43ec7 --- Core/Plugins/src/Core.Plugins.ProjectExplorer/ProjectTreeView.cs (.../ProjectTreeView.cs) (revision 48fe36c87dd40ff715adf4c0cf393f7390e6c993) +++ Core/Plugins/src/Core.Plugins.ProjectExplorer/ProjectTreeView.cs (.../ProjectTreeView.cs) (revision d121feba5299c86d7ac04a366ee869b163e43ec7) @@ -242,14 +242,14 @@ private void SubscribeProjectEvents() { - applicationCore.ProjectOpened += ApplicationCoreProjectOpened; + gui.ProjectOpened += ApplicationCoreProjectOpened; } private void UnsubscribeProjectEvents() { if (project != null) { - applicationCore.ProjectOpened -= ApplicationCoreProjectOpened; + gui.ProjectOpened -= ApplicationCoreProjectOpened; } } Index: Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/SharpMapGisGuiPlugin.cs =================================================================== diff -u -r48fe36c87dd40ff715adf4c0cf393f7390e6c993 -rd121feba5299c86d7ac04a366ee869b163e43ec7 --- Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/SharpMapGisGuiPlugin.cs (.../SharpMapGisGuiPlugin.cs) (revision 48fe36c87dd40ff715adf4c0cf393f7390e6c993) +++ Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/SharpMapGisGuiPlugin.cs (.../SharpMapGisGuiPlugin.cs) (revision d121feba5299c86d7ac04a366ee869b163e43ec7) @@ -135,7 +135,7 @@ gui.SelectionChanged += GuiSelectionChanged; gui.DocumentViews.ActiveViewChanged += DocumentViewsActiveViewChanged; gui.DocumentViews.ChildViewChanged += DocumentViewsActiveViewChanged; - gui.ApplicationCore.ProjectClosing += ApplicationProjectClosing; + gui.ProjectClosing += ApplicationProjectClosing; if (gui.ApplicationCore.ActivityRunner != null) { @@ -154,12 +154,11 @@ documentViews.ChildViewChanged -= DocumentViewsActiveViewChanged; documentViews.ActiveViewChanged -= DocumentViewsActiveViewChanged; } + gui.ProjectClosing -= ApplicationProjectClosing; var applicationCore = gui.ApplicationCore; if (gui.ApplicationCore != null) { - applicationCore.ProjectClosing -= ApplicationProjectClosing; - if (applicationCore.ActivityRunner != null) { applicationCore.ActivityRunner.ActivityCompleted -= ActivityRunnerOnActivityCompleted; Index: Core/Plugins/test/Core.Plugins.ProjectExplorer.Tests/ProjectExplorerPluginGuiTest.cs =================================================================== diff -u -r7b4f672be7e2d4eb74d7b7f7a88538b3f586d57c -rd121feba5299c86d7ac04a366ee869b163e43ec7 --- Core/Plugins/test/Core.Plugins.ProjectExplorer.Tests/ProjectExplorerPluginGuiTest.cs (.../ProjectExplorerPluginGuiTest.cs) (revision 7b4f672be7e2d4eb74d7b7f7a88538b3f586d57c) +++ Core/Plugins/test/Core.Plugins.ProjectExplorer.Tests/ProjectExplorerPluginGuiTest.cs (.../ProjectExplorerPluginGuiTest.cs) (revision d121feba5299c86d7ac04a366ee869b163e43ec7) @@ -24,6 +24,7 @@ mocks = new MockRepository(); gui = mocks.Stub(); + var project = new Project(); var settings = mocks.Stub(); var plugin = mocks.Stub(); var pluginGui = mocks.Stub(); @@ -41,6 +42,8 @@ projectExplorerPluginGui, pluginGui }).Repeat.Any(); + gui.Project = project; + //create and register a custom np mockNodePresenter = mocks.Stub(); Expect.Call(pluginGui.GetProjectTreeViewNodePresenters()).Return(new[] @@ -52,7 +55,6 @@ applicationCore = new ApplicationCore { - Project = new Project(), UserSettings = settings, Settings = new NameValueCollection { { "IsProjectExplorerSorted", "false" } } }; Index: Core/Plugins/test/Core.Plugins.SharpMapGis.Tests/Forms/MapLegendViewTest.cs =================================================================== diff -u -r48fe36c87dd40ff715adf4c0cf393f7390e6c993 -rd121feba5299c86d7ac04a366ee869b163e43ec7 --- Core/Plugins/test/Core.Plugins.SharpMapGis.Tests/Forms/MapLegendViewTest.cs (.../MapLegendViewTest.cs) (revision 48fe36c87dd40ff715adf4c0cf393f7390e6c993) +++ Core/Plugins/test/Core.Plugins.SharpMapGis.Tests/Forms/MapLegendViewTest.cs (.../MapLegendViewTest.cs) (revision d121feba5299c86d7ac04a366ee869b163e43ec7) @@ -110,7 +110,8 @@ private MapLegendView CreateMapLegendView() { - IGui gui = mocks.Stub(); + var project = new Project(); + var gui = mocks.Stub(); //create stubbed version of plugingui SharpMapGisGuiPlugin guiPlugin = new SharpMapGisGuiPlugin(); @@ -123,11 +124,13 @@ guiPlugin }).Repeat.Any(); Expect.Call(gui.ToolWindowViews).Return(mocks.Stub()).Repeat.Any(); - Expect.Call(gui.DocumentViews).Repeat.Any().Return(mocks.Stub()); + Expect.Call(gui.DocumentViews).Return(mocks.Stub()).Repeat.Any(); + gui.Project = project; + mocks.ReplayAll(); - var applicationCore = new ApplicationCore { Project = new Project() }; + var applicationCore = new ApplicationCore(); gui.ApplicationCore = applicationCore; Index: Core/Plugins/test/Core.Plugins.SharpMapGis.Tests/SharpMapGisGuiPluginTest.cs =================================================================== diff -u -r48fe36c87dd40ff715adf4c0cf393f7390e6c993 -rd121feba5299c86d7ac04a366ee869b163e43ec7 --- Core/Plugins/test/Core.Plugins.SharpMapGis.Tests/SharpMapGisGuiPluginTest.cs (.../SharpMapGisGuiPluginTest.cs) (revision 48fe36c87dd40ff715adf4c0cf393f7390e6c993) +++ Core/Plugins/test/Core.Plugins.SharpMapGis.Tests/SharpMapGisGuiPluginTest.cs (.../SharpMapGisGuiPluginTest.cs) (revision d121feba5299c86d7ac04a366ee869b163e43ec7) @@ -33,14 +33,16 @@ sharpMapGisPluginGui }).Repeat.Any(); + gui.Project = project; + var layerNode = new TreeNode(); var treeView = new TreeView(); treeView.Nodes.Add(layerNode); var vectorLayer = new VectorLayer("testLayer"); mocks.ReplayAll(); - var applicationCore = new ApplicationCore { Project = project }; + var applicationCore = new ApplicationCore(); gui.ApplicationCore = applicationCore; Index: Core/Plugins/test/Core.Plugins.SharpMapGis.Tests/SharpMapGisPluginGuiIntegrationTest.cs =================================================================== diff -u -rcaeb44054bb58aa8c480f86e7922a60ecf0f08ef -rd121feba5299c86d7ac04a366ee869b163e43ec7 --- Core/Plugins/test/Core.Plugins.SharpMapGis.Tests/SharpMapGisPluginGuiIntegrationTest.cs (.../SharpMapGisPluginGuiIntegrationTest.cs) (revision caeb44054bb58aa8c480f86e7922a60ecf0f08ef) +++ Core/Plugins/test/Core.Plugins.SharpMapGis.Tests/SharpMapGisPluginGuiIntegrationTest.cs (.../SharpMapGisPluginGuiIntegrationTest.cs) (revision d121feba5299c86d7ac04a366ee869b163e43ec7) @@ -54,7 +54,7 @@ map.Layers.Add(layer); map.NotifyObservers(); - gui.ApplicationCore.Project.Items.Add(map); + gui.Project.Items.Add(map); gui.CommandHandler.OpenView(map); @@ -117,7 +117,7 @@ }; map.Layers.Add(layer); - gui.ApplicationCore.Project.Items.Add(map); + gui.Project.Items.Add(map); gui.CommandHandler.OpenView(map); Index: Ringtoets/Demo/src/Ringtoets.Demo/Commands/AddNewDemoDikeAssessmentSectionCommand.cs =================================================================== diff -u -r48fe36c87dd40ff715adf4c0cf393f7390e6c993 -rd121feba5299c86d7ac04a366ee869b163e43ec7 --- Ringtoets/Demo/src/Ringtoets.Demo/Commands/AddNewDemoDikeAssessmentSectionCommand.cs (.../AddNewDemoDikeAssessmentSectionCommand.cs) (revision 48fe36c87dd40ff715adf4c0cf393f7390e6c993) +++ Ringtoets/Demo/src/Ringtoets.Demo/Commands/AddNewDemoDikeAssessmentSectionCommand.cs (.../AddNewDemoDikeAssessmentSectionCommand.cs) (revision d121feba5299c86d7ac04a366ee869b163e43ec7) @@ -29,7 +29,7 @@ public void Execute(params object[] arguments) { - var project = Gui.ApplicationCore.Project; + var project = Gui.Project; project.Items.Add(CreateNewDemoAssessmentSection()); project.NotifyObservers(); } Index: Ringtoets/Demo/src/Ringtoets.Demo/Commands/AddNewDemoDuneAssessmentSectionCommand.cs =================================================================== diff -u -r48fe36c87dd40ff715adf4c0cf393f7390e6c993 -rd121feba5299c86d7ac04a366ee869b163e43ec7 --- Ringtoets/Demo/src/Ringtoets.Demo/Commands/AddNewDemoDuneAssessmentSectionCommand.cs (.../AddNewDemoDuneAssessmentSectionCommand.cs) (revision 48fe36c87dd40ff715adf4c0cf393f7390e6c993) +++ Ringtoets/Demo/src/Ringtoets.Demo/Commands/AddNewDemoDuneAssessmentSectionCommand.cs (.../AddNewDemoDuneAssessmentSectionCommand.cs) (revision d121feba5299c86d7ac04a366ee869b163e43ec7) @@ -23,7 +23,7 @@ public void Execute(params object[] arguments) { - var project = Gui.ApplicationCore.Project; + var project = Gui.Project; project.Items.Add(CreateNewDemoAssessmentSection()); project.NotifyObservers(); } Index: Ringtoets/Demo/test/Ringtoets.Demo.Test/Commands/AddNewDemoDikeAssessmentSectionCommandTest.cs =================================================================== diff -u -rfb32e3411873a7b4c567792b9f335eba462e2702 -rd121feba5299c86d7ac04a366ee869b163e43ec7 --- Ringtoets/Demo/test/Ringtoets.Demo.Test/Commands/AddNewDemoDikeAssessmentSectionCommandTest.cs (.../AddNewDemoDikeAssessmentSectionCommandTest.cs) (revision fb32e3411873a7b4c567792b9f335eba462e2702) +++ Ringtoets/Demo/test/Ringtoets.Demo.Test/Commands/AddNewDemoDikeAssessmentSectionCommandTest.cs (.../AddNewDemoDikeAssessmentSectionCommandTest.cs) (revision d121feba5299c86d7ac04a366ee869b163e43ec7) @@ -33,21 +33,19 @@ public void Execute_GuiIsProperlyInitialized_AddNewDikeAssessmentSectionWithDemoDataToRootProject() { // Setup - var project = new Project(); - var mocks = new MockRepository(); var guiMock = mocks.Stub(); var observerMock = mocks.StrictMock(); observerMock.Expect(o => o.UpdateObserver()); + mocks.ReplayAll(); - var applicationCore = new ApplicationCore - { - Project = project - }; + var project = new Project(); + var applicationCore = new ApplicationCore(); + guiMock.Project = project; guiMock.ApplicationCore = applicationCore; var command = new AddNewDemoDikeAssessmentSectionCommand Index: Ringtoets/Demo/test/Ringtoets.Demo.Test/Commands/AddNewDemoDuneAssessmentSectionCommandTest.cs =================================================================== diff -u -r48fe36c87dd40ff715adf4c0cf393f7390e6c993 -rd121feba5299c86d7ac04a366ee869b163e43ec7 --- Ringtoets/Demo/test/Ringtoets.Demo.Test/Commands/AddNewDemoDuneAssessmentSectionCommandTest.cs (.../AddNewDemoDuneAssessmentSectionCommandTest.cs) (revision 48fe36c87dd40ff715adf4c0cf393f7390e6c993) +++ Ringtoets/Demo/test/Ringtoets.Demo.Test/Commands/AddNewDemoDuneAssessmentSectionCommandTest.cs (.../AddNewDemoDuneAssessmentSectionCommandTest.cs) (revision d121feba5299c86d7ac04a366ee869b163e43ec7) @@ -30,18 +30,18 @@ { // Setup var mocks = new MockRepository(); + var guiMock = mocks.Stub(); - var observerMock = mocks.StrictMock(); + var observerMock = mocks.StrictMock(); observerMock.Expect(o => o.UpdateObserver()); + mocks.ReplayAll(); var project = new Project(); - var applicationCore = new ApplicationCore - { - Project = project - }; + var applicationCore = new ApplicationCore(); + guiMock.Project = project; guiMock.ApplicationCore = applicationCore; var command = new AddNewDemoDuneAssessmentSectionCommand