Esempio n. 1
0
        public string PerformExport()
        {
            // the following is not available because it attempts to open a save file dialog
            // which can only be initiated via a user clicking a button; security feature of silverlight
            //GraphManager.Instance.PerformExport(graphComponents.Scope);

            GraphMLGraphDataFormat graphMlFormat = new GraphMLGraphDataFormat();
            GraphComponents graphComponents = GraphManager.Instance.DefaultGraphComponentsInstance;
            string exportedData = graphMlFormat.Export(graphComponents.Scope);

            return exportedData;
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes the proper graph format using the specified format
        /// </summary>
        /// <param name="format">Graph format</param>
        /// <returns>An intialized concrete GraphDataFormatBase</returns>
        /// <exception cref="InvalidOperationException">Thrown if the specified format is invalid</exception>
        private static GraphDataFormatBase InitializeGraphFormat(string format)
        {
            GraphDataFormatBase graphFormat;

            switch (format.ToLower())
            {
                case "graphml":
                    graphFormat = new GraphMLGraphDataFormat();
                    break;

                case "trac":
                    graphFormat = new TracGraphDataFormat();
                    break;

                case "anb":
                    graphFormat = new AnbGraphDataFormat();
                    break;
                default:
                    throw new InvalidOperationException("Unknown graph format");

            }

            return graphFormat;
        }
Esempio n. 3
0
        public void LoadGraphML(string xmlData)
        {
            // Get the main scope
            string scope = GraphManager.Instance.DefaultGraphComponentsInstance.Scope;
            GraphDataFormatBase format = new GraphMLGraphDataFormat();

            // Attempt to import that data
            GraphManager.Instance.ImportData(xmlData, scope, format);
        }