示例#1
0
        /// <summary>
        /// Deserialize a visual returning the appropriate visual object that is derived from
        /// the base VisualMsx object.
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>

        public static VisualMsx Deserialize(
            string data,
            AnalysisApplicationMsx app)
        {
            Type visType = null;

            if (data.IndexOf("<TablePlotMsx", StringComparison.OrdinalIgnoreCase) == 0)
            {
                visType = typeof(TablePlotMsx);
            }

            else if (data.IndexOf("<BarChartMsx", StringComparison.OrdinalIgnoreCase) == 0)
            {
                visType = typeof(BarChartMsx);
            }

            else if (data.IndexOf("<ScatterPlotMsx", StringComparison.OrdinalIgnoreCase) == 0)
            {
                visType = typeof(ScatterPlotMsx);
            }

            else if (data.IndexOf("<TreemapMsx", StringComparison.OrdinalIgnoreCase) == 0)
            {
                visType = typeof(TreemapMsx);
            }

            else if (data.IndexOf("<HeatMapMsx", StringComparison.OrdinalIgnoreCase) == 0)
            {
                visType = typeof(HeatMapMsx);
            }

            else if (data.IndexOf("<TrellisCardvisualMsx", StringComparison.OrdinalIgnoreCase) == 0)
            {
                visType = typeof(TrellisCardVisualMsx);
            }

            else
            {
                visType = typeof(VisualMsx);              // shouldn't happen
            }
            XmlSerializer xmlSer = new XmlSerializer(visType);
            StringReader  reader = new StringReader(data);

            VisualMsx visMsx = (VisualMsx)(xmlSer.Deserialize(reader));

            visMsx.SetApp(app);

            visMsx.UpdatePostDeserializationSecondaryReferences();

            return(visMsx);
        }
示例#2
0
/// <summary>
/// Deserialize a DocumentMsx
/// </summary>
/// <param name="serializedDoc"></param>
/// <returns></returns>

        public static DocumentMsx Deserialize(
            string serializedDoc,
            AnalysisApplicationMsx app)
        {
            DocumentMsx doc = (DocumentMsx)SerializeMsx.Deserialize(serializedDoc, typeof(DocumentMsx));

            app.Document = doc;

            doc.SetApp(app);

            doc.UpdatePostDeserializationSecondaryReferences();

            return(doc);
        }
示例#3
0
        /// <summary>
        /// SetApp
        /// </summary>
        /// <param name="app"></param>

        public void SetApp(AnalysisApplicationMsx app)
        {
            _app = app;
            return;
        }