Index: Core/Common/src/Core.Common.Base/IFileImporter.cs
===================================================================
diff -u -rd992a9538644381321f71d536c9ea85813d4c443 -r3a68ecde7d4aa9f0e7513e2bb9014a680edfd261
--- Core/Common/src/Core.Common.Base/IFileImporter.cs (.../IFileImporter.cs) (revision d992a9538644381321f71d536c9ea85813d4c443)
+++ Core/Common/src/Core.Common.Base/IFileImporter.cs (.../IFileImporter.cs) (revision 3a68ecde7d4aa9f0e7513e2bb9014a680edfd261)
@@ -49,11 +49,6 @@
ImportProgressChangedDelegate ProgressChanged { get; set; }
///
- /// Should the view for the imported item (if any) be automatically opened after import?
- ///
- bool OpenViewAfterImport { get; }
-
- ///
/// Indicates if this importer can import on the
///
/// Target object to check
Index: Core/Common/src/Core.Common.Base/Workflow/ActivityStatus.cs
===================================================================
diff -u -r5a1cb66da074b1dce5ef4748cde5e34a12bf6211 -r3a68ecde7d4aa9f0e7513e2bb9014a680edfd261
--- Core/Common/src/Core.Common.Base/Workflow/ActivityStatus.cs (.../ActivityStatus.cs) (revision 5a1cb66da074b1dce5ef4748cde5e34a12bf6211)
+++ Core/Common/src/Core.Common.Base/Workflow/ActivityStatus.cs (.../ActivityStatus.cs) (revision 3a68ecde7d4aa9f0e7513e2bb9014a680edfd261)
@@ -46,16 +46,6 @@
Finished,
///
- /// Cleaning all resources.
- ///
- Cleaning,
-
- ///
- /// Execution and cleaning resources are finished.
- ///
- Cleaned,
-
- ///
/// Activity has run but failed to complete.
///
Failed,
Index: Core/Common/src/Core.Common.Base/Workflow/FileImportActivity.cs
===================================================================
diff -u -rb459e67e645683509bed0eb854c2157e1ca12bba -r3a68ecde7d4aa9f0e7513e2bb9014a680edfd261
--- Core/Common/src/Core.Common.Base/Workflow/FileImportActivity.cs (.../FileImportActivity.cs) (revision b459e67e645683509bed0eb854c2157e1ca12bba)
+++ Core/Common/src/Core.Common.Base/Workflow/FileImportActivity.cs (.../FileImportActivity.cs) (revision 3a68ecde7d4aa9f0e7513e2bb9014a680edfd261)
@@ -4,10 +4,6 @@
{
public class FileImportActivity : Activity
{
- public event OnImportFinishedEventHandler OnImportFinished;
-
- public delegate void OnImportFinishedEventHandler(FileImportActivity fileImportActivity, object importedObject, IFileImporter importer);
-
private readonly object target;
private readonly IFileImporter importer;
private bool shouldCancel;
@@ -85,13 +81,7 @@
ProgressText = string.Format(Resources.FileImportActivity_ImportFromFile_Step_CurrentProgress_0_of_TotalProgress_1_____ProgressText_2, currentStep, totalSteps, currentStepName);
};
- var item = importer.ImportItem(fileName, target);
-
- //item might be null (for example when importing a wrong version of project)
- if (OnImportFinished != null && item != null)
- {
- OnImportFinished(this, item, importer);
- }
+ importer.ImportItem(fileName, target);
}
}
}
\ No newline at end of file
Index: Core/Common/src/Core.Common.Gui/GuiImportHandler.cs
===================================================================
diff -u -ra7e62eddad040f5d9585c279ebc1d84bc84b241e -r3a68ecde7d4aa9f0e7513e2bb9014a680edfd261
--- Core/Common/src/Core.Common.Gui/GuiImportHandler.cs (.../GuiImportHandler.cs) (revision a7e62eddad040f5d9585c279ebc1d84bc84b241e)
+++ Core/Common/src/Core.Common.Gui/GuiImportHandler.cs (.../GuiImportHandler.cs) (revision 3a68ecde7d4aa9f0e7513e2bb9014a680edfd261)
@@ -1,5 +1,4 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
@@ -9,7 +8,6 @@
using Core.Common.Gui.Forms;
using Core.Common.Gui.Forms.ProgressDialog;
using Core.Common.Gui.Properties;
-using Core.Common.Utils.Aop;
using Core.Common.Utils.IO;
using log4net;
using MessageBox = Core.Common.Controls.Swf.MessageBox;
@@ -157,30 +155,9 @@
}
}
- var importActivity = new FileImportActivity(importer, target);
-
- importActivity.OnImportFinished += ImportActivityOnImportFinished;
-
- ActivityProgressDialogRunner.Run(importActivity);
+ ActivityProgressDialogRunner.Run(new FileImportActivity(importer, target));
}
- private void ImportActivityOnImportFinished(FileImportActivity fileImportActivity, object importedObject, IFileImporter importer)
- {
- Environment.CurrentDirectory = AppDomain.CurrentDomain.BaseDirectory;
-
- if (importer.OpenViewAfterImport)
- {
- OpenViewForImportedObject(importedObject);
- }
- }
-
- [InvokeRequired]
- private void OpenViewForImportedObject(object importedObject)
- {
- gui.Selection = importedObject;
- gui.CommandHandler.OpenViewForSelection();
- }
-
///
///
///
@@ -205,13 +182,10 @@
Log.Info(Resources.GuiImportHandler_GetImportedItemsUsingFileOpenDialog_Start_importing_data);
- var importActivity = new FileImportActivity(importer, target)
+ ActivityProgressDialogRunner.Run(new FileImportActivity(importer, target)
{
Files = dialog.FileNames.ToArray()
- };
-
- importActivity.OnImportFinished += ImportActivityOnImportFinished;
- ActivityProgressDialogRunner.Run(importActivity);
+ });
}
}
}
\ No newline at end of file
Index: Core/Common/test/Core.Common.Integration.Test/Ringtoets/Application.Ringtoets/RingtoetsGuiIntegrationTest.cs
===================================================================
diff -u -rb459e67e645683509bed0eb854c2157e1ca12bba -r3a68ecde7d4aa9f0e7513e2bb9014a680edfd261
--- Core/Common/test/Core.Common.Integration.Test/Ringtoets/Application.Ringtoets/RingtoetsGuiIntegrationTest.cs (.../RingtoetsGuiIntegrationTest.cs) (revision b459e67e645683509bed0eb854c2157e1ca12bba)
+++ Core/Common/test/Core.Common.Integration.Test/Ringtoets/Application.Ringtoets/RingtoetsGuiIntegrationTest.cs (.../RingtoetsGuiIntegrationTest.cs) (revision 3a68ecde7d4aa9f0e7513e2bb9014a680edfd261)
@@ -1,8 +1,6 @@
using System;
using System.Linq;
-using System.Threading;
using Core.Common.Base;
-using Core.Common.Base.Workflow;
using Core.Common.Gui;
using Core.Common.TestUtils;
using Core.GIS.SharpMap.Map;
@@ -165,27 +163,6 @@
}
}
- private class TestActivity : Activity
- {
- public bool Done { get; set; }
-
- protected override void OnInitialize()
- {
- while (!Done)
- {
- Thread.Sleep(0);
- }
-
- Status = ActivityStatus.Done;
- }
-
- protected override void OnExecute() {}
-
- protected override void OnCancel() {}
-
- protected override void OnFinish() {}
- }
-
private static void StartWithCommonPlugins()
{
using (var gui = new RingtoetsGui())
Index: Core/Common/test/Core.Common.Test/Gui/ImportActivityTest.cs
===================================================================
diff -u -r5353e1a879e548055b8d20e357617f90b9289e6a -r3a68ecde7d4aa9f0e7513e2bb9014a680edfd261
--- Core/Common/test/Core.Common.Test/Gui/ImportActivityTest.cs (.../ImportActivityTest.cs) (revision 5353e1a879e548055b8d20e357617f90b9289e6a)
+++ Core/Common/test/Core.Common.Test/Gui/ImportActivityTest.cs (.../ImportActivityTest.cs) (revision 3a68ecde7d4aa9f0e7513e2bb9014a680edfd261)
@@ -26,18 +26,21 @@
}
};
- Expect.Call(importer.ImportItem("test1")).Repeat.Once().Return(new object());
- Expect.Call(importer.ImportItem("test2")).Repeat.Once().Return(new object());
- Expect.Call(importer.ImportItem("test3")).Repeat.Once().Return(new object());
+ Expect.Call(importer.ImportItem("test1")).Repeat.Once().Return(new object()).WhenCalled(o =>
+ {
+ project.Items.Add(o);
+ });
+ Expect.Call(importer.ImportItem("test2")).Repeat.Once().Return(new object()).WhenCalled(o =>
+ {
+ project.Items.Add(o);
+ });
+ Expect.Call(importer.ImportItem("test3")).Repeat.Once().Return(new object()).WhenCalled(o =>
+ {
+ project.Items.Add(o);
+ });
mockRepository.ReplayAll();
- // expect some reporting while processing each file
- fileImportActivity.OnImportFinished += (sender, importedObject, theImporter) =>
- {
- project.Items.Add(importedObject);
- };
-
fileImportActivity.Run();
Assert.AreEqual(3, project.Items.Count);
Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/PipingSoilProfilesImporter.cs
===================================================================
diff -u -r4c5a91a2a591b2b2e16f6a2abbaece9b2dac2157 -r3a68ecde7d4aa9f0e7513e2bb9014a680edfd261
--- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/PipingSoilProfilesImporter.cs (.../PipingSoilProfilesImporter.cs) (revision 4c5a91a2a591b2b2e16f6a2abbaece9b2dac2157)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/PipingSoilProfilesImporter.cs (.../PipingSoilProfilesImporter.cs) (revision 3a68ecde7d4aa9f0e7513e2bb9014a680edfd261)
@@ -67,14 +67,6 @@
public bool ShouldCancel { get; set; }
public ImportProgressChangedDelegate ProgressChanged { get; set; }
- public bool OpenViewAfterImport
- {
- get
- {
- return false;
- }
- }
-
public bool CanImportOn(object targetObject)
{
return targetObject is ICollection;
Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/PipingSurfaceLinesCsvImporter.cs
===================================================================
diff -u -r928b8bef8af19bae0ffa12872db1c259b4c93bca -r3a68ecde7d4aa9f0e7513e2bb9014a680edfd261
--- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/PipingSurfaceLinesCsvImporter.cs (.../PipingSurfaceLinesCsvImporter.cs) (revision 928b8bef8af19bae0ffa12872db1c259b4c93bca)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/PipingSurfaceLinesCsvImporter.cs (.../PipingSurfaceLinesCsvImporter.cs) (revision 3a68ecde7d4aa9f0e7513e2bb9014a680edfd261)
@@ -77,16 +77,9 @@
}
public bool ShouldCancel { get; set; }
+
public ImportProgressChangedDelegate ProgressChanged { get; set; }
- public bool OpenViewAfterImport
- {
- get
- {
- return false;
- }
- }
-
public bool CanImportOn(object targetObject)
{
return targetObject is ICollection;
Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/PipingSoilProfilesImporterTest.cs
===================================================================
diff -u -r4c5a91a2a591b2b2e16f6a2abbaece9b2dac2157 -r3a68ecde7d4aa9f0e7513e2bb9014a680edfd261
--- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/PipingSoilProfilesImporterTest.cs (.../PipingSoilProfilesImporterTest.cs) (revision 4c5a91a2a591b2b2e16f6a2abbaece9b2dac2157)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/PipingSoilProfilesImporterTest.cs (.../PipingSoilProfilesImporterTest.cs) (revision 3a68ecde7d4aa9f0e7513e2bb9014a680edfd261)
@@ -51,7 +51,6 @@
Assert.AreEqual(expectedFileFilter, importer.FileFilter);
Assert.IsFalse(importer.ShouldCancel);
Assert.IsNull(importer.ProgressChanged);
- Assert.IsFalse(importer.OpenViewAfterImport);
}
[Test]
Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/PipingSurfaceLineCsvImporterTest.cs
===================================================================
diff -u -r928b8bef8af19bae0ffa12872db1c259b4c93bca -r3a68ecde7d4aa9f0e7513e2bb9014a680edfd261
--- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/PipingSurfaceLineCsvImporterTest.cs (.../PipingSurfaceLineCsvImporterTest.cs) (revision 928b8bef8af19bae0ffa12872db1c259b4c93bca)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/PipingSurfaceLineCsvImporterTest.cs (.../PipingSurfaceLineCsvImporterTest.cs) (revision 3a68ecde7d4aa9f0e7513e2bb9014a680edfd261)
@@ -44,7 +44,6 @@
Assert.AreEqual(expectedFileFilter, importer.FileFilter);
Assert.IsFalse(importer.ShouldCancel);
Assert.IsNull(importer.ProgressChanged);
- Assert.IsFalse(importer.OpenViewAfterImport);
}
[Test]