コード例 #1
0
        /// <summary>
        /// Imports the provided data
        /// </summary>
        /// <param name="data">The data (in string format) to be imported</param>
        /// <param name="components">The GraphComponents instance</param>
        /// <param name="sourceMechanism">Specifies the mechanism for which objects on the graph were imported</param>
        /// <returns>true if the import was successfull (and contained
        /// data); otherwise false</returns>
        public bool Import(string data, GraphComponents components, CreationType sourceMechanism)
        {
            _logger.WriteLogEntry(LogLevel.DEBUG, "Import started", null, null);
            SnaglEventAggregator.DefaultInstance.GetEvent <DataImportingEvent>().Publish(new DataLoadedEventArgs(components.Scope, CreationType.Imported));

            // Cal the abstract ImportData method
            GraphMapData graph = ImportData(data);

            // Convert the mapping data to GraphComponents
            graph.ImportGraph(components, sourceMechanism);
            //MappingExtensions.ImportGraph(graph, components, sourceMechanism);

            _logger.WriteLogEntry(LogLevel.DEBUG, "Import completed", null, null);
            SnaglEventAggregator.DefaultInstance.GetEvent <DataImportedEvent>().Publish(new DataLoadedEventArgs(components.Scope, CreationType.Imported));

            return(true);
        }