• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Route类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: TestCreateAndGetAll

        public void TestCreateAndGetAll()
        {
            ICountryDao countryDao = new CountryDao(_graphClient);
            Country country = new Country() {Name = "D"};
            countryDao.Create(country);

            IRoutesDao routeDao = new RouteDao(_graphClient);
            Route route = new Route() {Name = "Route1"};
            routeDao.CreateIn(country, route);

            IDifficultyLevelScaleDao scaleDao = new DifficultyLevelScaleDao(_graphClient);
            DifficultyLevelScale scale = new DifficultyLevelScale() {Name = "sächsisch"};
            scaleDao.Create(scale);

            IDifficultyLevelDao levelDao = new DifficultyLevelDao(_graphClient);
            DifficultyLevel level = new DifficultyLevel() {Name = "7b"};
            levelDao.Create(scale, level);

            IVariationDao variationDao = new VariationDao(_graphClient);
            Variation variation = new Variation() {Name = "Ein Weg der Route1 als 7b"};
            Variation created = variationDao.Create(variation, route, level);

            IList<Variation> variationsOnRoute = variationDao.GetAllOn(route);
            Assert.AreEqual(1, variationsOnRoute.Count);
            Assert.AreEqual(variation.Name, variationsOnRoute.First().Name);
            Assert.AreEqual(variation.Id, variationsOnRoute.First().Id);
            Assert.AreEqual(created.Id, variationsOnRoute.First().Id);
        }
开发者ID:gitter-badger,项目名称:SummitLog,代码行数:28,代码来源:VariationDaoTest.cs


示例17: loadData

        //Loading data from data file
        public async void loadData() {
            Debug.WriteLine("Load Data Came");
            String[] lines;
            String[] temp;
            Route route;

            //Reading the text file
            var folder = Windows.ApplicationModel.Package.Current.InstalledLocation;
            var file = await folder.GetFileAsync("data.txt");
            var contents =  await Windows.Storage.FileIO.ReadTextAsync(file);

            //Seperate into variables
            lines = contents.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None);

            //Clear the buffers
            routes.Clear();
            //Read line by line to get the route number and the locations through the route
            for (int i = 0; i < lines.Length; i++)
            {
                temp = lines[i].Split('|');
                route = new Route(temp[0]);
                //Debug.WriteLine(temp[0] + "-------" + temp[1] + "------------" + temp[2]);
                route = processInput(temp[1], route);
                route = processInput(temp[2], route);
                
                //if else statements for preventing any exceptions due to duplicate key values
                if (!routes.ContainsKey(temp[0]))
                {
                    routes.Add(temp[0], route);
                }
            }

        }
开发者ID:nanduni-nin,项目名称:SL-Route-,代码行数:34,代码来源:SearchRoute.cs


示例18: append

	public void append(Route r){
		if(r != null){
			this.locations.AddRange (r.locations);
			this.length += r.length;
		}

	}
开发者ID:JBillingsley,项目名称:eecs-390-rts,代码行数:7,代码来源:Route.cs


示例19: Run

        public void Run()
        {
            while (true)
            {
                string input = this.UserInterface.ReadLine();
                if (input == null)
                {
                    break;
                }

                var route = new Route(input);
                var controllerType =
                    Assembly.GetExecutingAssembly().GetTypes().FirstOrDefault(type => type.Name == route.ControllerName);
                var controller = Activator.CreateInstance(controllerType, this.Database, this.User) as Controller;
                var action = controllerType.GetMethod(route.ActionName);
                object[] @params = MapParameters(route, action);
                try
                {
                    var view = action.Invoke(controller, @params) as IView;
                    this.UserInterface.WriteLine(view.Display());
                    this.User = controller.CurrentUser;
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.InnerException.Message);
                }
            }
        }
开发者ID:EBojilova,项目名称:CSharpHQC,代码行数:28,代码来源:Engine.cs


示例20: IsIgnored

		protected virtual bool IsIgnored(Route route)
		{
			if (route is IgnoredRoute)
				return true;

			return route.Tokens.GetValue<bool>(_ignoreKey);
		}
开发者ID:radischevo,项目名称:Radischevo.Wahha,代码行数:7,代码来源:RouteReader.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Routing.Route类代码示例发布时间:2022-05-24
下一篇:
C# RoundZone类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap