private NorthArrowAdornmentDeserializer(SerializationInfo info, StreamingContext context) { string alias = info.GetString("_alias"); string mapAlias = info.GetString("_mapAlias"); // See if the "same" map exists. MapInfo.Mapping.Map map = MapInfo.Engine.Session.Current.MapFactory[mapAlias]; if (map == null) { throw new SerializationException(MapInfo.Engine.Session.Current.Resources.GetString("MapInfo.Serialization.AdornmentMapNotFound", alias, mapAlias)); } IAdornment adornment = map.Adornments[alias]; if (adornment != null) { if (adornment is NorthArrowAdornment) { _adornment = (NorthArrowAdornment)adornment; } else { map.Adornments.Remove(alias); _adornment = null; adornment = null; } } // The "same" adornment doesn't exist. Create it from scratch. if (adornment == null) { _adornment = new NorthArrowAdornment(alias, mapAlias); //adornment = _adornment; map.Adornments.Append(_adornment); } _adornment.SetObjectData(info, context); }
private NorthArrowAdornmentDeserializer(SerializationInfo info, StreamingContext context) { string alias = info.GetString("_alias"); string mapAlias = info.GetString("_mapAlias"); // See if the "same" map exists. MapInfo.Mapping.Map map = MapInfo.Engine.Session.Current.MapFactory[mapAlias]; if (map == null) { throw new SerializationException(MapInfo.Engine.Session.Current.Resources.GetString("MapInfo.Serialization.AdornmentMapNotFound", alias, mapAlias)); } IAdornment adornment = map.Adornments[alias]; if (adornment != null) { if (adornment is NorthArrowAdornment) { _adornment = (NorthArrowAdornment)adornment; } else { map.Adornments.Remove(alias); _adornment=null; adornment=null; } } // The "same" adornment doesn't exist. Create it from scratch. if (adornment == null ) { _adornment = new NorthArrowAdornment(alias, mapAlias); //adornment = _adornment; map.Adornments.Append(_adornment); } _adornment.SetObjectData(info, context); }