示例#1
0
        /// <summary>
        /// Gets any existing RouteDescriptor for a destination, clears it using ReleaseRoute
        /// and then attempts a new Route and if sucessful, stores that RouteDescriptor
        /// in RouteDescriptorCollection.DefaultCollection
        /// </summary>
        public static void ReleaseAndMakeRoute(this IRoutingInputs destination, IRoutingOutputs source, eRoutingSignalType signalType)
        {
            destination.ReleaseRoute();

            if (source == null)
            {
                return;
            }
            var newRoute = destination.GetRouteToSource(source, signalType);

            if (newRoute == null)
            {
                return;
            }
            RouteDescriptorCollection.DefaultCollection.AddRouteDescriptor(newRoute);
            Debug.Console(2, destination, "Executing full route");
            newRoute.ExecuteRoutes();
        }
示例#2
0
        /// <summary>
        /// Gets any existing route for a destination, clears it, and then
        /// </summary>
        public static void ReleaseAndMakeRoute(this IRoutingInputs destination, IRoutingOutputs source, eRoutingSignalType signalType)
        {
            var sw = new Stopwatch();

            sw.Start();

            destination.ReleaseRoute();

            if (source == null)
            {
                return;
            }
            var newRoute = destination.GetRouteToSource(source, signalType);

            if (newRoute == null)
            {
                return;
            }
            RouteDescriptorCollection.DefaultCollection.AddRouteDescriptor(newRoute);
            Debug.Console(2, destination, "Executing new route");
            newRoute.ExecuteRoutes();
            sw.Stop();
            Debug.Console(2, destination, "Route took {0} ms", sw.ElapsedMilliseconds);
        }