Exemplo n.º 1
0
 /// <summary>
 /// Constructs a GeoUri from the specified <see cref="DataTypes.GeoLoc"/>
 /// </summary>
 /// <param name="geoLoc">The GeoLoc value to use for the resulting GeoUri</param>
 public GeoUri(DataTypes.GeoLoc geoLoc)
 {
     Value   = geoLoc ?? throw new ArgumentNullException(nameof(geoLoc));
     Uri     = new Uri(ToString());
     _params = null;
     Value.PropertyChanged += Value_PropertyChanged;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Constructs a GeoUri from the provided URI
 /// </summary>
 /// <param name="source"></param>
 public GeoUri(Uri source)
 {
     if (source == null)
     {
         throw new ArgumentNullException(nameof(source));
     }
     if (source.Scheme != SCHEME)
     {
         throw new ArgumentOutOfRangeException(ParsingHelper.UriWrongSchemeError(SCHEME));
     }
     Uri   = source;
     Value = new DataTypes.GeoLoc(Uri.LocalPath, out _params);
     Value.PropertyChanged += Value_PropertyChanged;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Constructs a GeoUri from the provided string
 /// </summary>
 /// <param name="uriSource"></param>
 public GeoUri(string uriSource)
 {
     if (string.IsNullOrWhiteSpace(uriSource))
     {
         throw new ArgumentNullException(nameof(uriSource));
     }
     if (!uriSource.Trim().ToLower().StartsWith(SCHEME))
     {
         throw new ArgumentOutOfRangeException(ParsingHelper.UriWrongSchemeError(SCHEME));
     }
     if (!Uri.IsWellFormedUriString(uriSource, UriKind.Relative))
     {
         throw new UriFormatException();
     }
     Uri   = new Uri(uriSource);
     Value = new DataTypes.GeoLoc(Uri.LocalPath, out _params);
     Value.PropertyChanged += Value_PropertyChanged;
 }