Index: Core/Common/src/Core.Common.Gui/Plugin/ExportInfo.cs =================================================================== diff -u -rdd84dcabe5561e637e4ade45457437d9c037535b -reff4bc47aee9786f42f3aa60728840b0793d6f96 --- Core/Common/src/Core.Common.Gui/Plugin/ExportInfo.cs (.../ExportInfo.cs) (revision dd84dcabe5561e637e4ade45457437d9c037535b) +++ Core/Common/src/Core.Common.Gui/Plugin/ExportInfo.cs (.../ExportInfo.cs) (revision eff4bc47aee9786f42f3aa60728840b0793d6f96) @@ -46,6 +46,15 @@ public Func CreateFileExporter { get; set; } /// + /// Gets or sets the method used to determine whether or not the export routine should be enabled. Function arguments: + /// + /// The data to export. + /// out - true if the export should be enabled, false otherwise. + /// + /// + public Func IsEnabled { get; set; } + + /// /// Gets or sets the name of the export information. /// public string Name { get; set; } @@ -98,6 +107,15 @@ public Func CreateFileExporter { get; set; } /// + /// Gets or sets the method used to determine whether or not the export routine should be enabled. Function arguments: + /// + /// The data to export. + /// out - true if the export should be enabled, false otherwise. + /// + /// + public Func IsEnabled { get; set; } + + /// /// Gets or sets the name of the export information. /// public string Name { get; set; } @@ -134,6 +152,7 @@ CreateFileExporter = (data, filePath) => exportInfo.CreateFileExporter != null ? exportInfo.CreateFileExporter((TData) data, filePath) : null, + IsEnabled = data => exportInfo.IsEnabled == null || exportInfo.IsEnabled((TData) data), Name = exportInfo.Name, Category = exportInfo.Category, Image = exportInfo.Image, Index: Core/Common/test/Core.Common.Gui.Test/Plugin/ExportInfoTest.cs =================================================================== diff -u -rdd84dcabe5561e637e4ade45457437d9c037535b -reff4bc47aee9786f42f3aa60728840b0793d6f96 --- Core/Common/test/Core.Common.Gui.Test/Plugin/ExportInfoTest.cs (.../ExportInfoTest.cs) (revision dd84dcabe5561e637e4ade45457437d9c037535b) +++ Core/Common/test/Core.Common.Gui.Test/Plugin/ExportInfoTest.cs (.../ExportInfoTest.cs) (revision eff4bc47aee9786f42f3aa60728840b0793d6f96) @@ -39,6 +39,7 @@ // Assert Assert.IsNull(info.DataType); Assert.IsNull(info.CreateFileExporter); + Assert.IsNull(info.IsEnabled); Assert.IsNullOrEmpty(info.Name); Assert.IsNullOrEmpty(info.Category); Assert.IsNull(info.Image); @@ -54,6 +55,7 @@ // Assert Assert.AreEqual(typeof(int), info.DataType); Assert.IsNull(info.CreateFileExporter); + Assert.IsNull(info.IsEnabled); Assert.IsNullOrEmpty(info.Name); Assert.IsNullOrEmpty(info.Category); Assert.IsNull(info.Image); @@ -76,6 +78,7 @@ var info = new ExportInfo { CreateFileExporter = (data, filePath) => fileExporter, + IsEnabled = data => false, Name = name, Category = category, Image = image, @@ -93,6 +96,8 @@ Assert.AreEqual(typeof(int), convertedInfo.DataType); Assert.IsNotNull(convertedInfo.CreateFileExporter); Assert.AreSame(fileExporter, convertedInfo.CreateFileExporter(12, string.Empty)); + Assert.IsNotNull(convertedInfo.IsEnabled); + Assert.IsFalse(convertedInfo.IsEnabled(12)); Assert.AreEqual(name, info.Name); Assert.AreEqual(category, info.Category); Assert.AreSame(image, info.Image); @@ -118,6 +123,8 @@ Assert.AreEqual(typeof(int), convertedInfo.DataType); Assert.IsNotNull(convertedInfo.CreateFileExporter); Assert.IsNull(convertedInfo.CreateFileExporter(new object(), string.Empty)); + Assert.IsNotNull(convertedInfo.IsEnabled); + Assert.IsTrue(convertedInfo.IsEnabled(new object())); Assert.IsNullOrEmpty(info.Name); Assert.IsNullOrEmpty(info.Category); Assert.IsNull(info.Image);