/// <summary>Flattens an instance of the object to a string that can be saved to app state or isolated storage</summary> /// <returns>Returns a flattened instance of the object that can be saved to app state or isolated storage</returns> public string ToStringRepresentation() { try { var sb = new StringBuilder(); if (Location != null) { sb.Append(double.IsNaN(Location.Latitude) ? "0" : Location.Latitude.ToString(CultureInfo.InvariantCulture)); sb.Append("|"); sb.Append(double.IsNaN(Location.Longitude) ? "0" : Location.Longitude.ToString(CultureInfo.InvariantCulture)); sb.Append("|"); sb.Append(double.IsNaN(Location.Altitude) ? "0" : Location.Altitude.ToString(CultureInfo.InvariantCulture)); sb.Append("|"); } else { sb.Append("0|0|0|"); } sb.Append(Address ?? string.Empty); sb.Append("|"); sb.Append(DistanceToRoundUpPoint.ToString(CultureInfo.InvariantCulture)); return(sb.ToString()); } catch (Exception ex) { Logger.Log(ex, "Error saving RoundUpPoint object to string representation", new StackFrame(0, true)); return(string.Empty); } }
/// <summary>Flattens an instance of the object to a string that can be saved to app state or isolated storage</summary> /// <returns>Returns a flattened instance of the object that can be saved to app state or isolated storage</returns> public string ToStringRepresentation() { // We save our properties in the following order: // id, Name, Location.Latitude, Location.Longitude, Location.Altitude, DistanceToRoundUpPoint (InstantMessage is not saved) try { var sb = new StringBuilder(); sb.Append(id.ToString(CultureInfo.InvariantCulture)); sb.Append("|"); sb.Append(Name); sb.Append("|"); if (Location != null) { sb.Append(double.IsNaN(Location.Latitude) ? "0" : Location.Latitude.ToString(CultureInfo.InvariantCulture)); sb.Append("|"); sb.Append(double.IsNaN(Location.Longitude) ? "0" : Location.Longitude.ToString(CultureInfo.InvariantCulture)); sb.Append("|"); sb.Append(double.IsNaN(Location.Altitude) ? "0" : Location.Altitude.ToString(CultureInfo.InvariantCulture)); sb.Append("|"); } else { sb.Append("0|0|0|"); } sb.Append(DistanceToRoundUpPoint.ToString(CultureInfo.InvariantCulture)); return(sb.ToString()); } catch (Exception ex) { Logger.Log(ex, "Error saving InviteeLocationMarker object to string representation", new StackFrame(0, true)); return(string.Empty); } }