当前位置: 首页>>代码示例>>C#>>正文


C# Route类代码示例

本文整理汇总了C#中Route的典型用法代码示例。如果您正苦于以下问题:C# Route类的具体用法?C# Route怎么用?C# Route使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Route类属于命名空间,在下文中一共展示了Route类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestRoute

        public void TestRoute()
        {
            string action = "/logInTrue/";
            Route route  = new Route(action, new TcpClient());

            Assert.AreEqual(route.Action, "logInTrue");
        }
开发者ID:DarkSideMoon,项目名称:HTTP-Server,代码行数:7,代码来源:TestRouting.cs

示例2: KmTool

 public KmTool(List<Adres> adreslijst)
 {
     this._adresLijst = adreslijst;
     waypoints = new List<WayPoint>();
     route = new Route();
     calculate();
 }
开发者ID:rohitrars,项目名称:ExampleBingMaps,代码行数:7,代码来源:KmTool.cs

示例3: CsvLoadTripRoutes

        public static void CsvLoadTripRoutes(string filename, bool lngFirst)
        {
            // load trip routes
            Dictionary<string, LinkedList<Waypoint>> routes = new Dictionary<string, LinkedList<Waypoint>>();
            using (CsvFileReader reader = new CsvFileReader(filename))
            {
                CsvRow row = new CsvRow();
                while (reader.ReadRow(row, ','))
                {
                    string routeID = row[0];
                    double distance = 0;
                    double lat = Convert.ToDouble(lngFirst ? row[2] : row[1]);
                    double lng = Convert.ToDouble(lngFirst ? row[1] : row[2]);
                    if (routes.ContainsKey(routeID))
                        distance = routes[routeID].First.Value.GetDistance(new Location(lat, lng, "null"));
                    Waypoint waypoint = new Waypoint(lat, lng, TimeSpan.Parse(row[3]), distance, row[4].Replace("\"", ""));

                    // Scenario #1
                    if (!routes.ContainsKey(routeID))
                        routes[routeID] = new LinkedList<Waypoint>();
                    routes[routeID].AddLast(waypoint);

                }
            }
            foreach (LinkedList<Waypoint> w in routes.Values)
            {
                Route r = new Route(w.ToArray());
                string key = Route.GetKey(r.start, r.end);
                MapTools.routes.Add(key, r);
            }
        }
开发者ID:TripThru,项目名称:Gateway,代码行数:31,代码来源:1397817436$MapTools.cs

示例4: considerRoute

        private void considerRoute(MarketDatabase.Order sellOrder, MarketDatabase.Order buyOrder)
        {
            Route r = new Route();
            r.profitPerItem = buyOrder.price * (1.0 - TAX_RATE) - sellOrder.price;

            if (r.profitPerItem<=0.0)
                return;

            double volumePerItem = items.idToEntry[sellOrder.item.typeId].volume;

            //int outlayQuantityBound = (int)(constraints.maxOutlay / sellOrder.price);
            //int volumeQuantityBound = (int)(constraints.maxVolume / volumePerItem);
            //int constraintsQuantityBound = Math.Min(outlayQuantityBound, volumeQuantityBound);

            r.seller = sellOrder;
            r.buyer = buyOrder;
            r.jumps = pather.getDistance(sellOrder.location, buyOrder.location);
            //negative jumps indicates no path found
            if (r.jumps < 0)
                return;
            r.quantity = Math.Min(sellOrder.quantity, buyOrder.quantity);
            r.profitDensityRate = r.profitPerItem / (volumePerItem * Math.Max(r.jumps, 1));
            r.bulkProfitRate = r.profitPerItem * r.quantity / Math.Max(r.jumps, 1);

            if ((r.profitDensityRate > constraints.minProfitDensityRate)
                && (r.bulkProfitRate > constraints.minBulkProfitRate))
            {
                systemRoutes[pather.graph.nameToId[r.seller.location.name]].Add(r);
                addedRoutes++;
            }
        }
开发者ID:fcostin,项目名称:eve_space_trucker,代码行数:31,代码来源:TradeRouteMiner.cs

示例5: MeasurePerformance

 /// <summary>
 /// Measures the performance.
 /// </summary>
 /// <param name="route">The route.</param>
 /// <param name="testTarget">The test target.</param>
 /// <param name="tests">The tests.</param>
 /// <returns>A performance value or null if performance could not be measured</returns>
 public ProxyPerformance MeasurePerformance(Route route, Uri testTarget, int tests = 3)
 {
     try
     {
         var ping = TimeSpan.Zero;
         var downloadTime = TimeSpan.Zero;
         var downloadSize = 0;
         var timer = new Stopwatch();
         timer.Start();
         for (int test = 0; test < tests; test++)
         {
             var t0 = timer.Elapsed;
             using (var stream = route.Connect(testTarget, NameResolver))
             {
                 var t1 = timer.Elapsed;
                 ping += t1 - t0;
                 HttpRequest.CreateGet(testTarget).Write(stream);
                 var t2 = timer.Elapsed;
                 var httpResponse = HttpResponse.FromStream(stream);
                 downloadSize += httpResponse.ReadContent(stream).Length;
                 var t3 = timer.Elapsed;
                 downloadTime += t3 - t2;
             }
         }
         return new ProxyPerformance(TimeSpan.FromTicks(ping.Ticks / tests), downloadSize / downloadTime.TotalSeconds);
     }
     catch (ProxyRouteException)
     { }
     catch (IOException)
     { }
     catch (SocketException)
     { }
     return null;
 }
开发者ID:systemmetaphor,项目名称:BlueDwarf,代码行数:41,代码来源:ProxyAnalyzer.cs

示例6: PostPlanRouteCallback

        public static void PostPlanRouteCallback(Route r, string routeType, string result)
        {
            try
            {
                if ((r.Follower != null) && (r.Follower.Target is Sim))
                {
                    if (((r.GetOption(Route.RouteOption.EnableSubwayPlanning)) || (r.GetOption2(Route.RouteOption2.EnableHoverTrainPlanning))) && !r.GetOption(Route.RouteOption.EnableUFOPlanning))
                    {
                        CheckAndUpdateRouteForPortals(r);
                    }

                    if (((routeType == "Replan") || (routeType == "ReplanFromPoint")) && r.GetOption(Route.RouteOption.PlanUsingStroller))
                    {
                        r.SetOption(Route.RouteOption.ReplanUsingStroller, false);
                    }

                    if (RoutingComponent.sPostPlanProfileCallback != null)
                    {
                        RoutingComponent.sPostPlanProfileCallback(r, routeType, result);
                    }
                }
            }
            catch (Exception e)
            {
                Common.Exception("PostPlanRouteCallback", e);
            }
        }
开发者ID:Robobeurre,项目名称:NRaas,代码行数:27,代码来源:AncientPortalRoutingHelper.cs

示例7: RoutePassed

 public static void RoutePassed(Route route)
 {
     Invoke(() => {
         Context.Log.Add(new Log {Route = route, Finish = DateTime.Now, Succeed = true});
         Context.SaveChanges();
     });
 }
开发者ID:maximbaz,项目名称:LegoRobot,代码行数:7,代码来源:Db.cs

示例8: ReturnOneMethod

        public void ReturnOneMethod(IProxyFactory proxyFactory, ILogger logger)
        {
            var alternationImplementation = new Route(proxyFactory, logger);

            Assert.Equal(2, alternationImplementation.AllMethodsRouteBase.Count());
            Assert.Equal(3, alternationImplementation.AllMethodsRoute.Count());
        } 
开发者ID:GitObjects,项目名称:Glimpse,代码行数:7,代码来源:RouteShould+.cs

示例9: CalculateHousesVisited

        int CalculateHousesVisited(string input, bool includeRobot)
        {
            if (!includeRobot)
            {
                var route = new Route();

                for (var i = 0; i < input.Length; i++)
                    route.VisitNextHouse(input[i]);

                return route.Houses.Count;
            }
            else
            {
                var route1 = new Route();
                var route2 = new Route();

                for (var i = 0; i < input.Length; i++)
                {
                    if (i % 2 == 0)
                        route1.VisitNextHouse(input[i]);
                    else
                        route2.VisitNextHouse(input[i]);
                }

                var combined = route1.Houses;
                
                foreach (var robotRoute in route2.Houses)
                    if (!combined.Any(x => x.X == robotRoute.X && x.Y == robotRoute.Y))
                        combined.Add(robotRoute);
                
                return combined.Count;
            }
        }
开发者ID:arnolddustin,项目名称:AdventOfCode,代码行数:33,代码来源:Day03.cs

示例10: Draw

 private void Draw(Route route)
 {
     var line = _polyLineCreator.Create(route);
     _canvas.Children.Add(line);
     Canvas.SetZIndex(line, 0);
     _polyLineCreator.SetNextRandomBrush();
 }
开发者ID:SergeyValavin,项目名称:MultiObjectiveOpitimzation,代码行数:7,代码来源:RouteRender.cs

示例11: MapRoute

 public static void MapRoute(this RouteCollection routes, string name, string url, string handlerToken, object defaults, object constraints)
 {
     Route route = new Route(url,
         new RouteValueDictionary(defaults),
         new RouteValueDictionary(constraints), GetRouteHandler(handlerToken));
     routes.Add(name, route);
 }
开发者ID:shalves,项目名称:CompactMVC,代码行数:7,代码来源:RouteCollectionExtensions.cs

示例12: CreateRoute

        static Route CreateRoute(DependencyObject d)
        {
            var routeString = GetRoute(d);

            var action = routeString.Split(' ')[0];
            var resource = routeString.Split(' ')[1];

            var route = new Route(action, resource);

            var view = ViewProperties.GetView(d);
            route.AddParameter(KnownParameters.ParentView, view);
            var showAs = ViewProperties.GetShowAs(d);
            route.AddParameter(KnownParameters.ParentShowAs, showAs);

            var parameters = GetParams(d);

            if (parameters != null)
            {
                foreach (var p in parameters)
                {
                    var element = d as FrameworkElement;
                    p.DataContext = element.DataContext;
                    route.AddParameter(p.Key, p.Value);
                }
            }

            return route;
        }
开发者ID:RookieOne,项目名称:Chimera,代码行数:28,代码来源:RouteBehavior.cs

示例13: executeStrategy

        public override Solution executeStrategy(Solution toStartFrom)
        {
            Planning = toStartFrom.GetRandomPlanning();
            if (Planning.Item3.Count == 0)
                return toStartFrom;

            OriginalRoute = Planning.Item3[random.Next(Planning.Item3.Count)];
            if (OriginalRoute == null || OriginalRoute.Orders.Count < 2)
                return toStartFrom;

            int orderIndex = random.Next(OriginalRoute.Orders.Count - 1);
            OrderRemoved = OriginalRoute.Orders[orderIndex];
            OrderBefore = orderIndex == 0 ? null : OriginalRoute.Orders[orderIndex - 1];
            OrderRemoved.AddAvailableOrderBackToCluster();
            OriginalRoute.RemoveOrder(OrderRemoved);

            if (OriginalRoute.Orders.Count == 1)
            { // Basically delete the route (remove it from planning)
                toStartFrom.RemoveRouteFromPlanning(Planning.Item1, Planning.Item2, OriginalRoute);
                toStartFrom.RemoveRoute(OriginalRoute);
            }

            strategyHasExecuted = true;
            return toStartFrom;
        }
开发者ID:Gliath,项目名称:GroteOpdrachtOpt,代码行数:25,代码来源:RandomOrderRemoveStrategy.cs

示例14: Level

        public Level()
        {
            Vector2 levelSize = new Vector2(32, 18);

            grid = new int[(int)levelSize.X, (int)levelSize.Y];
            map = new int[(int)levelSize.X * 100, (int)levelSize.Y * 100];

            for (int i = 0; i < levelSize.X; i++)
                for (int j = 0; j < levelSize.Y; j++)
                    grid[i, j] = 0;

            for (int i = 0; i < levelSize.X * 100; i++)
                for (int j = 0; j < levelSize.Y * 100; j++)
                    map[i, j] = 0;

            enemies = new List<Enemy>();
            path = new List<PathBlock>();
            corpses = new List<Vector4>();

            allWaves = new Queue<Wave>();

            route = new Route();
            projectiles = new List<Projectile>();

            maxEnemies = 0;
        }
开发者ID:Zaldroc,项目名称:TowerDefense,代码行数:26,代码来源:Level.cs

示例15: BindDDL

        private void BindDDL()
        {
            try
            {
                IList<RouteInfo> dRouteList = new Route().GetList();
                ddlRouteName.DataSource = dRouteList;
                ddlRouteName.DataBind();

                IList<ShipInfo> dShipList = new Ship().GetList();
                ddlShipName.DataSource = dShipList;
                ddlShipName.DataBind();
                ddlShipName.Items.Insert(0, new ListItem("全部", ""));

                //tbStartTime.Text = DateTime.Now.ToString("yyyy-MM-dd");
                //tbEndTime.Text = DateTime.Now.ToString("yyyy-MM-dd");

            }
            catch (ArgumentNullException aex)
            {
                ShowMsg(aex.Message);
            }
            catch (Exception ex)
            {
                ShowMsg(ex.Message);
                Log(ex);
            }
        }
开发者ID:shanfree,项目名称:SharpReport,代码行数:27,代码来源:VoyageLoadStatistic.aspx.cs


注:本文中的Route类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。