Пример #1
0
        /// <summary>
        /// Invokes the specified service method.
        /// </summary>
        /// <param name="method">The method to be invoked.</param>
        /// <exception cref="ArgumentNullException"><paramref name="method"/> is a null
        /// reference.</exception>
        private TResult _Invoke <TResult>(Func <TService, TResult> method)
        {
            CodeContract.RequiresNotNull("method", method);

            var invocationWrapper = new RetriableInvocationWrapper(
                MAX_RETRY_COUNT,
                _PrepareRetry,
                _TranslateException);

            var result = default(TResult);

            invocationWrapper.Invoke(() =>
            {
                try
                {
                    using (var connection = _connectionPool.AcquireConnection())
                    {
                        result = method(connection.Client);
                    }
                }
                catch (Exception ex)
                {
                    if (!_exceptionHandler.HandleException(ex, _serviceTitle))
                    {
                        throw;
                    }
                }
            });

            return(result);
        }
Пример #2
0
        /// <summary>
        /// Creates a new instance of the <see cref="WorldGeocoder"/> class for the specified
        /// service configuration.
        /// </summary>
        /// <param name="serviceInfo">The instance of the geocoding service configuration
        /// specifying World geocoder service to create geocoder for.</param>
        /// <param name="exceptionHandler">Exception handler.</param>
        /// <returns>A new instance of the <see cref="WorldGeocoder"/> class.</returns>
        /// <exception cref="System.ArgumentNullException"><paramref name="serviceInfo"/> is a null
        /// reference.</exception>
        public static GeocoderBase CreateWorldGeocoder(GeocodingServiceInfo serviceInfo,
                                                       IServiceExceptionHandler exceptionHandler)
        {
            CodeContract.RequiresNotNull("serviceInfo", serviceInfo);

            // Create binding for the geocoder REST service.
            var webBinding             = ServiceHelper.CreateWebHttpBinding("WorldGeocoder");
            var binding                = new CustomBinding(webBinding);
            var messageEncodingElement = binding.Elements.Find <WebMessageEncodingBindingElement>();

            messageEncodingElement.ContentTypeMapper = new ArcGisWebContentTypeMapper();

            // Create endpoint for the geocoder REST service.
            var contract       = ContractDescription.GetContract(typeof(IGeocodingService));
            var serviceAddress = new EndpointAddress(serviceInfo.RestUrl);
            var endpoint       = new WebHttpEndpoint(contract, serviceAddress);

            endpoint.Binding = binding;

            // Replace default endpoint behavior with a customized one.
            endpoint.Behaviors.Remove <WebHttpBehavior>();
            endpoint.Behaviors.Add(new GeocodingServiceWebHttpBehavior());

            // Create the geocoder instance.
            var channelFactory = new WebChannelFactory <IGeocodingService>(endpoint);
            var client         = new GeocodingServiceClient(channelFactory, serviceInfo, exceptionHandler);

            return(new WorldGeocoder(serviceInfo, client));
        }
Пример #3
0
        /// <summary>
        /// Removes elements in the specified collection for which the specified predicate
        /// returns true in the range [first, last).
        /// </summary>
        /// <typeparam name="T">The type of elements in the collection.</typeparam>
        /// <param name="source">The collection to remove elements from.</param>
        /// <param name="first">The index in the <paramref name="source"/> collection specifying
        /// the beginning of the elements range to perform removing at.</param>
        /// <param name="last">The index in the <paramref name="source"/> collection specifying
        /// the end of the elements range to perform removing at.</param>
        /// <param name="predicate">The predicate to be used for finding elements
        /// to be removed.</param>
        /// <returns>The index in the <paramref name="source"/> collection such that all elements
        /// in range [0, index) do not satisfy the <paramref name="predicate"/>.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="source"/> or
        /// <paramref name="predicate"/> is a null reference.</exception>
        /// <exception cref="ArgumentOutOfRangeException"><paramref name="first"/> or
        /// <paramref name="last"/> is not in [0, <paramref name="source"/>.Count] range or
        /// <paramref name="first"/> is greater than <paramref name="last"/>.</exception>
        /// <remarks>The relative order of element that are not removed is the same as their
        /// relative order before removal of other elements.</remarks>
        public static int RemoveIf <T>(
            this IList <T> source,
            int first,
            int last,
            Func <T, bool> predicate)
        {
            CodeContract.RequiresNotNull("source", source);
            CodeContract.RequiresValueInRange("first", first, 0, source.Count);
            CodeContract.RequiresValueInRange("last", last, 0, source.Count);
            CodeContract.RequiresLessThanOrEqual("first", first, last);
            CodeContract.RequiresNotNull("predicate", predicate);

            var next = first;

            for (; first != last; ++first)
            {
                if (!predicate(source[first]))
                {
                    var tmp = source[next];
                    source[next]  = source[first];
                    source[first] = tmp;

                    ++next;
                }
            }

            return(next);
        }
Пример #4
0
        /// <summary>
        /// Returns a reference to the <see cref="Tracker"/> class object.
        /// </summary>
        /// <param name="solver">The solver to be used by the returned tracker.</param>
        /// <param name="geocoder">The geocoder to be used by the returned tracker.</param>
        /// <param name="messageReporter">The messageReporter to be used by the returned
        /// tracker.</param>
        /// <returns>A new <see cref="Tracker"/> class instance.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="solver"/>,
        /// <paramref name="geocoder"/> or <paramref name="messageReporter"/> is a null
        /// reference.</exception>
        public Tracker GetTracker(
            IVrpSolver solver,
            IGeocoder geocoder,
            IMessageReporter messageReporter)
        {
            CodeContract.RequiresNotNull("solver", solver);
            CodeContract.RequiresNotNull("geocoder", geocoder);
            CodeContract.RequiresNotNull("messageReporter", messageReporter);

            _CheckSettings(_settings);

            var settings = new TrackingSettings
            {
                BreakTolerance = _settings.TrackingSettings.BreakTolerance ?? 0,
            };

            var uri     = new Uri(_settings.TrackingServiceInfo.RestUrl);
            var service = FeatureService.Create(uri, Server);
            var trackingServiceClient = new TrackingServiceClient(service);

            var trackingService        = new TrackingServiceClient(service);
            var synchronizationService = new SynchronizationService(trackingServiceClient);

            return(new Tracker(
                       settings,
                       trackingService,
                       synchronizationService,
                       solver,
                       geocoder,
                       messageReporter));
        }
Пример #5
0
        /// <summary>
        /// Cancels asynchronous reverse geocoding operation.
        /// </summary>
        /// <param name="userToken">Token of the geocoding operation that must be cancelled.</param>
        /// <returns>Returns <c>true</c> if operation successfully cancelled, or <c>false</c> if
        /// operation with the token was not found.</returns>
        /// <exception cref="System.ArgumentNullException"><paramref name="userToken"/> is a null
        /// reference.</exception>
        public override bool ReverseGeocodeAsyncCancel(object userToken)
        {
            CodeContract.RequiresNotNull("userToken", userToken);

            _client.CancelAsync(userToken);

            return(true);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="RoutesCollectionOwner"/> class.
        /// </summary>
        /// <param name="routes">A collection of routes owned by this instance.</param>
        public RoutesCollectionOwner(IDataObjectCollection <Route> routes)
        {
            CodeContract.RequiresNotNull("routes", routes);

            _routes = routes;
            _routes.CollectionChanged += _RoutesCollectionChanged;
            _TrackAssociations();
        }
Пример #7
0
        /// <summary>
        /// Geocodes an address and returns the best candidate.
        /// </summary>
        /// <param name="address">Address to geocode.</param>
        /// <returns>Returns address candidate with max score.</returns>
        /// <exception cref="System.ArgumentNullException"><paramref name="address"/> is a null
        /// reference.</exception>
        public override AddressCandidate Geocode(Address address)
        {
            CodeContract.RequiresNotNull("address", address);

            var response = _client.FindAddress(address.FullAddress, address.Country, null);

            return(_Convert(response));
        }
Пример #8
0
        /// <summary>
        /// Removes all elements in the specified collection for which the specified predicate
        /// returns true.
        /// </summary>
        /// <typeparam name="T">The type of elements in the collection.</typeparam>
        /// <param name="source">The collection to remove elements from.</param>
        /// <param name="predicate">The predicate to be used for finding elements
        /// to be removed.</param>
        /// <returns>The index in the <paramref name="source"/> collection such that all elements
        /// in range [0, index) do not satisfy the <paramref name="predicate"/>.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="source"/> or
        /// <paramref name="predicate"/> is a null reference.</exception>
        /// <remarks>The relative order of element that are not removed is the same as their
        /// relative order before removal of other elements.</remarks>
        public static int RemoveIf <T>(
            this IList <T> source,
            Func <T, bool> predicate)
        {
            CodeContract.RequiresNotNull("source", source);
            CodeContract.RequiresNotNull("predicate", predicate);

            return(source.RemoveIf(0, source.Count, predicate));
        }
        /// <summary>
        /// Creates a new instance of the <see cref="RouteAssociationTracker"/> class.
        /// </summary>
        /// <typeparam name="TProperty">The type of the Route property to track association
        /// with.</typeparam>
        /// <param name="expression">The member expression specifying Route property to
        /// track.</param>
        /// <returns>A new instance of the <see cref="RouteAssociationTracker"/> class for the
        /// specified Route property.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="expression"/> is
        /// a null reference.</exception>
        /// <exception cref="System.ArgumentOutOfRangeException"><paramref name="expression"/> node
        /// type is not <see cref="ExpressionType.MemberAccess"/>.</exception>
        public static RouteAssociationTracker Create <TProperty>(
            Expression <Func <Route, TProperty> > expression)
        {
            CodeContract.RequiresNotNull("expression", expression);

            var propertyInfo = TypeInfoProvider <Route> .GetPropertyInfo(expression);

            return(new RouteAssociationTracker(propertyInfo));
        }
Пример #10
0
        /// <summary>
        /// Marks the specified cell as dirty.
        /// </summary>
        /// <param name="cell">The cell object to be marked dirty.</param>
        /// <exception cref="System.ArgumentNullException"><paramref name="cell"/> is a null
        /// reference.</exception>
        public static void MarkDirty(this Cell cell)
        {
            CodeContract.RequiresNotNull("cell", cell);

            var content = cell.Content;

            cell.Content = new object();
            cell.Content = content;
        }
Пример #11
0
        /// <summary>
        /// Gets <see cref="PropertyDescriptor"/> object for the specified
        /// <see cref="PropertyInfo"/> object.
        /// </summary>
        /// <param name="propertyInfo">The <see cref="PropertyInfo"/> object for the property
        /// to get descriptor for.</param>
        /// <returns>A <see cref="PropertyDescriptor"/> object for the specified property.</returns>
        /// <exception cref="System.ArgumentNullException"><paramref name="propertyInfo"/> argument
        /// is a null reference.</exception>
        public static PropertyDescriptor GetDescriptor(this PropertyInfo propertyInfo)
        {
            CodeContract.RequiresNotNull("propertyInfo", propertyInfo);

            var descriptor = TypeDescriptor.GetProperties(propertyInfo.DeclaringType)
                             .Cast <PropertyDescriptor>()
                             .First(property => property.Name == propertyInfo.Name);

            return(descriptor);
        }
        /// <summary>
        /// Finds all routes associated with the specified object.
        /// </summary>
        /// <param name="associatedObject">The object to find routes associated with.</param>
        /// <returns>A collection of routes associated with the specified object.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="associatedObject"/> is
        /// a null reference.</exception>
        public IEnumerable <Route> FindRoutes(DataObject associatedObject)
        {
            CodeContract.RequiresNotNull("associatedObject", associatedObject);

            var tracker = default(RouteAssociationTracker);

            if (!_associationTrackers.TryGetValue(associatedObject.GetType(), out tracker))
            {
                return(Enumerable.Empty <Route>());
            }

            return(tracker.FindRoutes(associatedObject));
        }
Пример #13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RestServiceClient&lt;TService&gt;"/> class.
        /// </summary>
        /// <param name="channelFactory">The reference to the channel factory instance
        /// to be used for creating communication channels for the REST service.</param>
        /// <param name="serviceTitle">The title of the REST service.</param>
        /// <param name="exceptionHandler">Exception handler.</param>
        /// <exception cref="ArgumentNullException"><paramref name="channelFactory"/> or
        /// <paramref name="serviceTitle"/> is a null reference.</exception>
        public RestServiceClient(
            ChannelFactory <TService> channelFactory,
            string serviceTitle,
            IServiceExceptionHandler exceptionHandler)
        {
            CodeContract.RequiresNotNull("channelFactory", channelFactory);
            CodeContract.RequiresNotNull("serviceTitle", serviceTitle);
            CodeContract.RequiresNotNull("exceptionHandler", exceptionHandler);

            _connectionPool   = new WcfClientConnectionPool <TService>(channelFactory);
            _serviceTitle     = serviceTitle;
            _exceptionHandler = exceptionHandler;
        }
Пример #14
0
        /// <summary>
        /// Begins an asynchronous operation to reverse geocode the specified location.
        /// </summary>
        /// <param name="location">The point at which to search for the closest address.</param>
        /// <param name="outputSpatialReference">The spatial reference in which to return address
        /// points. The default is WKID 4326.</param>
        /// <param name="distance">The distance in meters from the given location within which
        /// a matching address should be searched. The default is 0.</param>
        /// <param name="userState">An arbitrary user state object which can be used for
        /// asynchronous operation cancellation.</param>
        /// <exception cref="ArgumentNullException"><paramref name="userState"/> is a null
        /// reference.</exception>
        public void ReverseGeocodeAsync(
            Point location,
            int?outputSpatialReference,
            double?distance,
            object userState)
        {
            CodeContract.RequiresNotNull("userState", userState);

            _serviceClient.InvokeAsync(
                client => client.ReverseGeocode(location, outputSpatialReference, distance),
                this.ReverseGeocodeCompleted,
                userState);
        }
        /// <summary>
        /// Finds all routes associated with the specified associated object.
        /// </summary>
        /// <param name="associatedObject">The object for which to find associated
        /// routes.</param>
        /// <returns>A collection of routes referencing the specified object.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="associatedObject"/> is
        /// a null reference.</exception>
        public IEnumerable <Route> FindRoutes(DataObject associatedObject)
        {
            CodeContract.RequiresNotNull("associatedObject", associatedObject);

            var routes = default(HashSet <Route>);

            if (!_backAssociation.TryGetValue(associatedObject, out routes))
            {
                return(Enumerable.Empty <Route>());
            }

            return(routes);
        }
Пример #16
0
        /// <summary>
        /// Starts asynchronous operation execution.
        /// </summary>
        /// <param name="method">The method for starting asynchronous operation.</param>
        /// <exception cref="ArgumentNullException"><paramref name="method"/> is a null
        /// reference.</exception>
        public void InvokeAsync <TResult>(
            Func <TService, TResult> method,
            EventHandler <AsyncOperationCompletedEventArgs <TResult> > operationCompletedNotifier,
            object userState)
            where TResult : IFaultInfo
        {
            CodeContract.RequiresNotNull("method", method);
            CodeContract.RequiresNotNull("operationCompletedNotifier", operationCompletedNotifier);
            CodeContract.RequiresNotNull("userState", userState);

            // Prepare asynchronous operation state object.
            var asyncState = new AsyncState
            {
                UserState = userState,

                CancellationNotifier = () =>
                {
                    var eventArguments = AsyncOperationCompletedEventArgs.Create(
                        default(TResult),
                        null,
                        true,
                        userState);
                    if (operationCompletedNotifier != null)
                    {
                        operationCompletedNotifier(this, eventArguments);
                    }
                },

                CancellationTokenSource = new CancellationTokenSource(),
            };

            // Make asynchronous operation cancellable.
            var cancellationToken = asyncState.CancellationTokenSource.Token;

            // Register operation.
            lock (_operationsGuard)
            {
                if (userState != null)
                {
                    _operations.Add(userState, asyncState);
                }
            }

            // Finally invoke the operation.
            Task.Factory
            .StartNew(
                () => _Invoke(method),
                cancellationToken)
            .ContinueWith(
                task => _HandleOperationCompletion(task, operationCompletedNotifier, asyncState));
        }
Пример #17
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WorldGeocoder"/> class.
        /// </summary>
        /// <param name="serviceInfo">The geocoding service configuration information.</param>
        /// <param name="client">The geocoding service client object.</param>
        /// <exception cref="System.ArgumentNullException"><paramref name="serviceInfo"/> or
        /// <paramref name="client"/> is a null reference.</exception>
        public WorldGeocoder(
            GeocodingServiceInfo serviceInfo,
            IGeocodingServiceClient client)
        {
            CodeContract.RequiresNotNull("serviceInfo", serviceInfo);
            CodeContract.RequiresNotNull("client", client);

            _serviceInfo = serviceInfo;
            _client      = client;

            _client.ReverseGeocodeCompleted += _ClientReverseGeocodeCompleted;

            _locatorsInfos = new ReadOnlyCollection <LocatorInfo>(new List <LocatorInfo>());
        }
Пример #18
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GeocodingServiceClient"/> class.
        /// </summary>
        /// <param name="channelFactory">The reference to the channel factory instance
        /// to be used for creating communication channels for the geocoder service.</param>
        /// <param name="serviceInfo">The configuration information for the geocoder
        /// service.</param>
        /// <param name="exceptionHandler">Exception handler.</param>
        /// <exception cref="ArgumentNullException"><paramref name="channelFactory"/> or
        /// <paramref name="serviceInfo"/> is a null reference.</exception>
        public GeocodingServiceClient(
            ChannelFactory <IGeocodingService> channelFactory,
            GeocodingServiceInfo serviceInfo,
            IServiceExceptionHandler exceptionHandler)
        {
            CodeContract.RequiresNotNull("channelFactory", channelFactory);
            CodeContract.RequiresNotNull("serviceInfo", serviceInfo);
            CodeContract.RequiresNotNull("exceptionHandler", exceptionHandler);

            _serviceClient = new RestServiceClient <IGeocodingService>(
                channelFactory,
                serviceInfo.Title,
                exceptionHandler);
        }
        /// <summary>
        /// Updates association between the specified route and related object accessed by the
        /// route property with the specified name.
        /// </summary>
        /// <param name="route">The route object to update association for.</param>
        /// <param name="propertyName">The name of the route property to update association
        /// with.</param>
        /// <exception cref="ArgumentNullException"><paramref name="route"/> or
        /// <paramref name="propertyName"/> is a null reference.</exception>
        public void UpdateRouteAssociation(Route route, string propertyName)
        {
            CodeContract.RequiresNotNull("route", route);
            CodeContract.RequiresNotNull("propertyName", propertyName);

            var tracker = default(RouteAssociationTracker);

            if (!_associationTrackersByPropertyName.TryGetValue(propertyName, out tracker))
            {
                return;
            }

            tracker.UnregisterRoute(route);
            tracker.RegisterRoute(route);
        }
Пример #20
0
        /// <summary>
        /// Invokes service method that returns a value of type T.
        /// </summary>
        /// <typeparam name="TResult">The type of the operation result.</typeparam>
        /// <param name="method">The method to be invoked.</param>
        /// <returns>Result of the specified method invocation.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="method"/> is a null
        /// reference.</exception>
        /// <exception cref="CommunicationException">Failed to communicate with the REST
        /// service.</exception>
        public TResult Invoke <TResult>(Func <TService, TResult> method)
            where TResult : IFaultInfo
        {
            CodeContract.RequiresNotNull("method", method);

            var response = _Invoke(method);

            var error = _ValidateResponse(response);

            if (error != null)
            {
                throw error;
            }

            return(response);
        }
Пример #21
0
        /// <summary>
        /// Geocodes array of addresses.
        /// </summary>
        /// <param name="addresses">Array of addresses.</param>
        /// <returns>Returns array of best candidates for each input address.</returns>
        /// <exception cref="System.ArgumentNullException"><paramref name="addresses"/> or any of
        /// its elements is a null reference.</exception>
        public override AddressCandidate[] BatchGeocode(Address[] addresses)
        {
            // "addresses" array elements will be validated by the Geocode method, so check only
            // the array itself here.
            CodeContract.RequiresNotNull("addresses", addresses);

            var candidates = new List <AddressCandidate>();

            foreach (var address in addresses)
            {
                var candidate = this.Geocode(address);
                if (candidate != null)
                {
                    candidates.Add(candidate);
                }
            }

            return(candidates.ToArray());
        }
Пример #22
0
        /// <summary>
        /// Geocodes address and returns array of found candidates.
        /// </summary>
        /// <param name="address">Address to geocode.</param>
        /// <param name="includeDisabledLocators">Is need to add candidates from disabled locators.</param>
        /// <returns>Returns array of found address candidates.</returns>
        /// <exception cref="System.ArgumentNullException"><paramref name="address"/> is a null
        /// reference.</exception>
        public override AddressCandidate[] GeocodeCandidates(Address address, bool includeDisabledLocators)
        {
            CodeContract.RequiresNotNull("address", address);

            var response = _client.FindAddressCandidates(
                address.FullAddress,
                address.Country,
                null);

            if (response == null)
            {
                return(null);
            }

            // Convert address candidates to the internal application objects.
            var candidates = response.Candidates
                             .Select(_Convert)
                             .ToArray();

            return(candidates);
        }
Пример #23
0
        /// <summary>
        /// Cancels asynchronous operation associated with the specified object.
        /// </summary>
        /// <param name="userState">The user state object to cancel asynchronous operation
        /// for.</param>
        /// <exception cref="ArgumentNullException"><paramref name="userState"/> is a null
        /// reference.</exception>
        public void CancelAsync(object userState)
        {
            CodeContract.RequiresNotNull("userState", userState);

            // Remove operation associated with the user state from a collection of running
            // asynchronous operations.
            var asyncState = default(AsyncState);

            lock (_operationsGuard)
            {
                if (!_operations.TryGetValue(userState, out asyncState))
                {
                    return;
                }

                _operations.Remove(userState);
            }

            // Request cancelling operation execution.
            asyncState.CancellationTokenSource.Cancel();

            // Notify clients that operation was canceled.
            asyncState.CancellationNotifier();
        }
Пример #24
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Tracker"/> class.
        /// </summary>
        /// <param name="settings">Settings to be used by the tracker.</param>
        /// <param name="trackingService">The tracking service client to be used to communicate
        /// with the tracking server.</param>
        /// <param name="synchronizationService">The synchronization service to be used for
        /// synchronizing data in the project and at the tracking service.</param>
        /// <param name="solver">The VRP solver to be used by the tracker.</param>
        /// <param name="geocoder">The geocoder to be used by the tracker.</param>
        /// <param name="messageReporter">The message reporter to be used for reporting
        /// tracking errors.</param>
        /// <exception cref="ArgumentNullException"><paramref name="settings"/>,
        /// <paramref name="trackingService"/>, <paramref name="synchronizationService"/>,
        /// <paramref name="solver"/>, <paramref name="geocoder"/> or
        /// <paramref name="messageReporter"/> is a null reference.</exception>
        internal Tracker(
            TrackingSettings settings,
            ITrackingService trackingService,
            ISynchronizationService synchronizationService,
            IVrpSolver solver,
            IGeocoder geocoder,
            IMessageReporter messageReporter)
        {
            CodeContract.RequiresNotNull("settings", settings);
            CodeContract.RequiresNotNull("trackingService", trackingService);
            CodeContract.RequiresNotNull("synchronizationService", synchronizationService);
            CodeContract.RequiresNotNull("solver", solver);
            CodeContract.RequiresNotNull("geocoder", geocoder);
            CodeContract.RequiresNotNull("messageReporter", messageReporter);

            _settings               = settings;
            _trackingService        = trackingService;
            _synchronizationService = synchronizationService;

            _solver = solver;

            _geocoder        = geocoder;
            _messageReporter = messageReporter;
        }
Пример #25
0
        /// <summary>
        /// Cancels asynchronous operation associated with the specified object.
        /// </summary>
        /// <param name="userState">The user state object to cancel asynchronous operation
        /// for.</param>
        /// <exception cref="ArgumentNullException"><paramref name="userState"/> is a null
        /// reference.</exception>
        public void CancelAsync(object userState)
        {
            CodeContract.RequiresNotNull("userState", userState);

            _serviceClient.CancelAsync(userState);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="WcfClientConnectionPool&lt;TService&gt;"/>
        /// class.
        /// </summary>
        /// <param name="channelFactory">The reference to the channel factory instance
        /// to be used for creating communication channels for the REST service.</param>
        /// <exception cref="ArgumentNullException"><paramref name="channelFactory"/> is a null
        /// reference.</exception>
        public WcfClientConnectionPool(ChannelFactory <TService> channelFactory)
        {
            CodeContract.RequiresNotNull("channelFactory", channelFactory);

            _channelFactory = channelFactory;
        }
Пример #27
0
        /// <summary>
        /// Finds address by geographical location. Asynchronous method.
        /// </summary>
        /// <param name="location">Location point.</param>
        /// <param name="userToken">Geocoding operation token.</param>
        /// <exception cref="System.ArgumentNullException"><paramref name="userToken"/> is a null
        /// reference.</exception>
        public override void ReverseGeocodeAsync(Geometry.Point location, object userToken)
        {
            CodeContract.RequiresNotNull("userToken", userToken);

            _client.ReverseGeocodeAsync(location, null, null, userToken);
        }