using System; using System.Collections.Generic; using System.Drawing; namespace Core.Common.Base { public delegate void ImportProgressChangedDelegate(string currentStepName, int currentStep, int totalSteps); /// /// Interface for data import from external formats /// public interface IFileImporter { /// /// The name of the importer /// string Name { get; } /// /// The category of the importer /// string Category { get; } /// /// The image of the importer /// Bitmap Image { get; } /// /// The data types supported by the importer /// IEnumerable SupportedItemTypes { get; } /// /// Indicates whether or not the importer can import at root level (folder/project). If true, the /// importer will always show up in the project->import list. If false this importer can only be /// retrieved by supported type, eg, in code. Use false for partial/composite importers and importers /// called from map tools etc. If true for TargetFileImporter, the importer is assumed to support /// both *new* and *into* modes. /// /// HACK: REMOVE IT, KEEP DESIGN SIMPLE! bool CanImportOnRootLevel { get; } /// /// The file filter of the importer /// /// "My file format1 (*.ext1)|*.ext1|My file format2 (*.ext2)|*.ext2" string FileFilter { get; } /// /// Path where external data files can be copied into /// /// Optional, used only when external files need to be copied into the project "as is" string TargetDataDirectory { get; set; } /// /// Whether or not an import task should be cancelled /// /// This property must be observed by the importer (thread-safe); when it is true the importer must stop current import task bool ShouldCancel { get; set; } /// /// Fired when progress has been changed /// 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 bool CanImportOn(object targetObject); /// /// Imports data from the file with path /// object ImportItem(string path, object target = null); } }