Index: Core/Common/src/Core.Common.Gui/Commands/GuiExportHandler.cs
===================================================================
diff -u -re5f1cd1570345bda1637fe121e88aada5bb8d60e -rc4956adaabe6d54f55069ef05be2fbde323de015
--- Core/Common/src/Core.Common.Gui/Commands/GuiExportHandler.cs (.../GuiExportHandler.cs) (revision e5f1cd1570345bda1637fe121e88aada5bb8d60e)
+++ Core/Common/src/Core.Common.Gui/Commands/GuiExportHandler.cs (.../GuiExportHandler.cs) (revision c4956adaabe6d54f55069ef05be2fbde323de015)
@@ -29,7 +29,6 @@
using Core.Common.Gui.Helpers;
using Core.Common.Gui.Plugin;
using Core.Common.Gui.Properties;
-using Core.Common.Util;
using Core.Common.Util.Reflection;
using log4net;
Index: Core/Common/src/Core.Common.Gui/Plugin/ExportInfo.cs
===================================================================
diff -u -r6cdb90fc3f89fe0c44b62d3be7266a0090a6b891 -rc4956adaabe6d54f55069ef05be2fbde323de015
--- Core/Common/src/Core.Common.Gui/Plugin/ExportInfo.cs (.../ExportInfo.cs) (revision 6cdb90fc3f89fe0c44b62d3be7266a0090a6b891)
+++ Core/Common/src/Core.Common.Gui/Plugin/ExportInfo.cs (.../ExportInfo.cs) (revision c4956adaabe6d54f55069ef05be2fbde323de015)
@@ -77,6 +77,14 @@
/// Gets or sets the file filter generator of the export information used to make file filters.
///
public FileFilterGenerator FileFilterGenerator { get; set; }
+
+ ///
+ /// Gets or sets the method used to get the path where the export should save the data. Function arguments:
+ ///
+ /// - out - the path to export to.
+ ///
+ ///
+ public Func GetExportPath { get; set; }
}
///
@@ -88,13 +96,7 @@
///
/// Gets the data type associated with this export info.
///
- public Type DataType
- {
- get
- {
- return typeof(TData);
- }
- }
+ public Type DataType => typeof(TData);
///
/// Gets or sets the method used to create a . Function arguments:
@@ -138,6 +140,14 @@
public FileFilterGenerator FileFilterGenerator { get; set; }
///
+ /// Gets or sets the method used to get the path where the export should save the data. Function arguments:
+ ///
+ /// - out - the path to export to.
+ ///
+ ///
+ public Func GetExportPath { get; set; }
+
+ ///
/// Performs an implicit conversion from to .
///
/// The export information to convert.
@@ -152,7 +162,8 @@
Name = exportInfo.Name,
Category = exportInfo.Category,
Image = exportInfo.Image,
- FileFilterGenerator = exportInfo.FileFilterGenerator
+ FileFilterGenerator = exportInfo.FileFilterGenerator,
+ GetExportPath = (fileFilter) => exportInfo.GetExportPath?.Invoke(fileFilter)
};
}
}
Index: Core/Common/test/Core.Common.Gui.Test/Plugin/ExportInfoTest.cs
===================================================================
diff -u -r51b64230b9b947ba32821ed104809429d469959b -rc4956adaabe6d54f55069ef05be2fbde323de015
--- Core/Common/test/Core.Common.Gui.Test/Plugin/ExportInfoTest.cs (.../ExportInfoTest.cs) (revision 51b64230b9b947ba32821ed104809429d469959b)
+++ Core/Common/test/Core.Common.Gui.Test/Plugin/ExportInfoTest.cs (.../ExportInfoTest.cs) (revision c4956adaabe6d54f55069ef05be2fbde323de015)
@@ -47,6 +47,7 @@
Assert.AreEqual("Algemeen", info.Category);
TestHelper.AssertImagesAreEqual(Resources.ExportIcon, info.Image);
Assert.IsNull(info.FileFilterGenerator);
+ Assert.IsNull(info.GetExportPath);
}
[Test]
@@ -63,6 +64,7 @@
Assert.AreEqual("Algemeen", info.Category);
TestHelper.AssertImagesAreEqual(Resources.ExportIcon, info.Image);
Assert.IsNull(info.FileFilterGenerator);
+ Assert.IsNull(info.GetExportPath);
}
[Test]
@@ -77,6 +79,7 @@
const string category = "category";
var image = new Bitmap(16, 16);
var generator = new FileFilterGenerator();
+ const string exportPath = "C:/path";
var info = new ExportInfo
{
@@ -85,7 +88,8 @@
Name = name,
Category = category,
Image = image,
- FileFilterGenerator = generator
+ FileFilterGenerator = generator,
+ GetExportPath = filterGenerator => exportPath
};
// Precondition
@@ -105,6 +109,7 @@
Assert.AreEqual(category, info.Category);
Assert.AreSame(image, info.Image);
Assert.AreEqual(generator, info.FileFilterGenerator);
+ Assert.AreEqual(exportPath, info.GetExportPath(new FileFilterGenerator()));
mocks.VerifyAll();
}
@@ -132,6 +137,7 @@
Assert.AreEqual("Algemeen", info.Category);
TestHelper.AssertImagesAreEqual(Resources.ExportIcon, info.Image);
Assert.IsNull(info.FileFilterGenerator);
+ Assert.IsNull(info.GetExportPath);
}
}
}
\ No newline at end of file