/// <summary> /// Deserialization constructor /// </summary> /// <param name="info"></param> /// <param name="context"></param> public GraphAbstract(SerializationInfo info, StreamingContext context) { #region Version test //test the version, warn if the build or major is different Version currentversion = Assembly.GetExecutingAssembly().GetName().Version; Version fileversion = new Version(info.GetString("NetronGraphLibVersion")); int diff = currentversion.CompareTo(fileversion); if (fileversion.Minor != currentversion.Minor || fileversion.Major != currentversion.Major) { DialogResult res = MessageBox.Show("The graph was saved in version " + fileversion.ToString() + " while the current graph library has version " + currentversion.ToString() + ". It is not guaranteed that the graph will appeare as it was when saved. Are you sure you want to open the graph?", "Different version", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (res == DialogResult.No) { return; } } #endregion Init(); this.mShapes = info.GetValue("mShapes", typeof(ShapeCollection)) as ShapeCollection; this.mConnections = info.GetValue("mConnections", typeof(ConnectionCollection)) as ConnectionCollection; this.mGraphInformation = info.GetValue("mGraphInformation", typeof(GraphInformation)) as GraphInformation; this.mLayers = info.GetValue("mLayers", typeof(GraphLayerCollection)) as GraphLayerCollection; }
/// <summary> /// Deserialization constructor /// </summary> /// <param name="info"></param> /// <param name="context"></param> public GraphAbstract(SerializationInfo info, StreamingContext context) { #region Version test //test the version, warn if the build or major is different Version currentversion = Assembly.GetExecutingAssembly().GetName().Version; Version fileversion = new Version(info.GetString("NetronGraphLibVersion")); int diff = currentversion.CompareTo(fileversion); if (fileversion.Minor != currentversion.Minor || fileversion.Major != currentversion.Major) { DialogResult res = MessageBox.Show("The graph was saved in version " + fileversion.ToString() + " while the current graph library has version " + currentversion.ToString() + ". It is not guaranteed that the graph will appeare as it was when saved. Are you sure you want to open the graph?", "Different version", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (res == DialogResult.No) { return; } } #endregion this.mShapes = info.GetValue("mShapes", typeof(ShapeCollection)) as ShapeCollection; this.mConnections = info.GetValue("mConnections", typeof(ConnectionCollection)) as ConnectionCollection; this.mGraphInformation = info.GetValue("mGraphInformation", typeof(GraphInformation)) as GraphInformation; this.mLayers = info.GetValue("mLayers", typeof(GraphLayerCollection)) as GraphLayerCollection; if (mLayers != null) { GraphLayer layer = mLayers["Default"]; if (layer == null) { layer = new GraphLayer("Default", Color.WhiteSmoke, 100); layer.UseColor = false; //use colors only for upper layers layer.Visible = false; mLayers.Add(layer); } // foreach (GraphLayer tLayer in mLayers) // { // if (tLayer != null && tLayer.Visible) // { // mCurrentLayer = tLayer; // break; // } // } // if (mCurrentLayer == null) // { // mCurrentLayer = DefaultLayer; // } // if (mCurrentLayer != null) mCurrentLayer.Visible = true; mLayers.ClearComplete += new EventHandler(Layers_ClearComplete); } BindEntityCollectionEvents(); }
/// <summary> /// Default ctor /// </summary> public GraphAbstract() { mGraphInformation = new GraphInformation(); Init(); // Insert(DefaultLayer); mCurrentLayer = DefaultLayer; mCurrentLayer.Visible = true; }
/// <summary> /// Default ctor /// </summary> public GraphAbstract() { mGraphInformation = new GraphInformation(); Init(); }