/// <summary> /// Initializes a new instance of the <see cref="TrackerProvider"/> class. /// </summary> /// <param name="settings">Tracking settings to be used for created <see cref="Tracker"/> /// class instances.</param> /// <param name="servers">Collection of ags servers.</param> /// <exception cref="ArgumentNullException"><paramref name="settings"/> or /// <paramref name="servers"/> is a null reference.</exception> /// <exception cref="ArgumentException"><paramref name="settings"/> contains invalid /// tracking settings.</exception> public TrackerProvider(TrackingInfo settings, ICollection<Services.AgsServer> servers) { _CheckSettings(settings); if (servers == null) throw new ArgumentNullException("servers"); _settings = settings; Server = _GetServerByName(servers, settings.TrackingServiceInfo.ServerName); }
private static void _ValidateSettings(TrackingInfo settings) { if (settings == null || settings.TrackingServiceInfo == null || string.IsNullOrEmpty(settings.TrackingServiceInfo.RestUrl) || settings.TrackingSettings == null) { throw new ApplicationException(Properties.Messages.Error_InvalidTrackingConfig); } }
/// <summary> /// Check that tracking settings are valid. /// </summary> /// <param name="settings">Tracking settings to be used for creating <see cref="Tracker"/> /// class instances.</param> /// <exception cref="ArgumentNullException"><paramref name="settings"/> is a null /// reference.</exception> /// <exception cref="ArgumentException"><paramref name="settings"/> contains invalid /// tracking settings.</exception> private static void _CheckSettings(TrackingInfo settings) { if (settings == null) throw new ArgumentNullException("TrackingInfo", Properties.Messages.Warning_NoTrackingConfig); if (settings.TrackingServiceInfo == null || string.IsNullOrEmpty(settings.TrackingServiceInfo.RestUrl) || string.IsNullOrEmpty(settings.TrackingServiceInfo.ServerName) || settings.TrackingSettings == null) { throw new ArgumentException( Properties.Messages.Error_InvalidTrackingConfig, "settings"); } }