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


C# IRoute类代码示例

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


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

示例1: RouteMatch

 /// <summary>
 /// Initializes a new instance of the <see cref="RouteMatch"/> class.
 /// </summary>
 /// <param name="success">if set to <c>true</c> [success].</param>
 /// <param name="route">The route.</param>
 /// <param name="parameterValues">The parameter values.</param>
 /// <param name="failReason">The fail reason.</param>
 private RouteMatch(bool success, IRoute route, IDictionary parameterValues, string failReason)
 {
     this.success = success;
     this.route = route;
     this.failReason = failReason;
     values = new RouteValueDictionary(parameterValues);
 }
开发者ID:p69,项目名称:magellan-framework,代码行数:14,代码来源:RouteMatch.cs

示例2: MatchPath

 /// <summary>
 /// Given a path, attempts to match the next part of it to the current segment.
 /// </summary>
 /// <param name="route">The route.</param>
 /// <param name="path">The path.</param>
 /// <returns>
 /// An object that indicates whether the path was successfully matched.
 /// </returns>
 public override SegmentPathMatch MatchPath(IRoute route, PathIterator path)
 {
     var next = path.Next();
     return String.Equals(next, literal, StringComparison.InvariantCultureIgnoreCase)
         ? SegmentPathMatch.Successful()
         : SegmentPathMatch.Failure(string.Format("Expected segment '{0}'; got '{1}'", literal, next));
 }
开发者ID:p69,项目名称:magellan-framework,代码行数:15,代码来源:LiteralSegment.cs

示例3: CalculateBestPlacement

        /// <summary>
        /// Returns the customer that least increases the length of the given route.
        /// </summary>
        /// <param name="problem"></param>
        /// <param name="route"></param>
        /// <returns></returns>
        public static TwoOptResult CalculateBestPlacement(
            IProblemWeights problem,
            IRoute route)
        {
            //int previous1 = -1;
            //foreach (int customer1 in route)
            //{
            //    if (previous1 >= 0)
            //    {
            //        int previous2 = -1;
            //        foreach (int customer2 in route)
            //        {
            //            if (previous1 != previous2)
            //            {
            //                // test the two opt move.

            //            }

            //            previous2 = customer2;
            //        }
            //    }

            //    previous1 = customer1;
            //}
            throw new NotImplementedException();
        }
开发者ID:jorik041,项目名称:osmsharp,代码行数:32,代码来源:TwoOptHelper.cs

示例4: MatchPath

        /// <summary>
        /// Given a path, attempts to match the next part of it to the current segment.
        /// </summary>
        /// <param name="route">The route.</param>
        /// <param name="path">The path.</param>
        /// <returns>
        /// An object that indicates whether the path was successfully matched.
        /// </returns>
        public override SegmentPathMatch MatchPath(IRoute route, PathIterator path)
        {
            var values = new RouteValueDictionary();
            var next = path.Next();
            
            if (next.Length == 0)
            {
                if (defaultValue != UrlParameter.NotSpecified)
                {
                    values[parameterName] = defaultValue;
                }
                else
                {
                    return SegmentPathMatch.Failure(string.Format("The path does not contain a segment for parameter '{0}'", parameterName));   
                }
            }
            else
            {
                values[parameterName] = next;

                if (constraint != null && !constraint.IsValid(route, next, parameterName))
                {
                    return SegmentPathMatch.Failure(string.Format("Segment '{0}' did not match the constraint on parameter '{1}'", next, parameterName));
                }
            }
            return SegmentPathMatch.Successful(values);
        }
开发者ID:p69,项目名称:magellan-framework,代码行数:35,代码来源:ParameterSegment.cs

示例5: Log

 public void Log(IRoute route)
 {
     _routeLog.Add(route);
     Routes = _routeLog
         .OrderByDescending(r => r.End)
         .ToList();
 }
开发者ID:RookieOne,项目名称:Chimera,代码行数:7,代码来源:OpenViewModel.cs

示例6: Show

        public void Show(IRoute route, IEnumerable<IError> errors)
        {
            var view = route[KnownParameters.View] as UserControl;

            var adornerLayer = AdornerLayer.GetAdornerLayer(view);
            adornerLayer.Add(new ErrorsAdorner(view, errors));
        }
开发者ID:RookieOne,项目名称:Chimera,代码行数:7,代码来源:ErrorPresenter.cs

示例7: Matches

        public bool Matches(IRoute route, IPath path)
        {
            var routePath = route.Path;
            if (!routePath.IsLiteral)
                return false;

            return routePath.LiteralPath.Equals(path.LiteralPath);
        }
开发者ID:ReactiveMarkets,项目名称:Styx,代码行数:8,代码来源:LiteralRankedRoutePredicate.cs

示例8: NancyEngineFixture

        public NancyEngineFixture()
        {
            this.resolver = A.Fake<IRouteResolver>();
            this.route = A.Fake<IRoute>();

            A.CallTo(() => resolver.GetRoute(A<IRequest>.Ignored.Argument)).Returns(route);
            this.engine = new NancyEngine(resolver);
        }
开发者ID:tt,项目名称:Nancy,代码行数:8,代码来源:NancyEngineFixture.cs

示例9: CreateViewModel

        public object CreateViewModel(IRoute route)
        {
            var type = GetTypeFor(route);

            if (type == null)
                return null;

            return IoC.Get(type);
        }
开发者ID:RookieOne,项目名称:Chimera,代码行数:9,代码来源:ViewModelEngine.cs

示例10: PathMatch

 /// <summary>
 /// Initializes a new instance of the <see cref="PathMatch"/> class.
 /// </summary>
 /// <param name="success">if set to <c>true</c> [success].</param>
 /// <param name="route">The route.</param>
 /// <param name="routeValues">The route values.</param>
 /// <param name="leftOver">The left over.</param>
 /// <param name="segmentValues">The segment values.</param>
 /// <param name="failReason">The fail reason.</param>
 private PathMatch(bool success, IRoute route, RouteValueDictionary routeValues, RouteValueDictionary leftOver, List<object> segmentValues, string failReason)
 {
     this.success = success;
     this.route = route;
     this.routeValues = routeValues;
     this.leftOver = leftOver;
     this.segmentValues = segmentValues;
     this.failReason = failReason;
 }
开发者ID:p69,项目名称:magellan-framework,代码行数:18,代码来源:PathMatch.cs

示例11: Process

        public IRouteResult Process(IRoute route)
        {
            var listener = route[KnownParameters.Listener] as IListener;

            var result = listener.Execute(route)
                .AddParameter(KnownParameters.ProcessedByListener, true);

            return result as IRouteResult;
        }
开发者ID:RookieOne,项目名称:Chimera,代码行数:9,代码来源:ListenerProcessor.cs

示例12: CreateView

        public object CreateView(IRoute route)
        {
            var type = GetTypeFor(route);

            if (type == null)
                return null;

            return Activator.CreateInstance(type);
        }
开发者ID:RookieOne,项目名称:Chimera,代码行数:9,代码来源:ViewEngine.cs

示例13: CheckParameter

        private static object CheckParameter(IRoute route, ParameterInfo parameterInfo)
        {
            if (parameterInfo.ParameterType == typeof(int))
            {
                return int.Parse(route.Parameters[parameterInfo.Name]);
            }

            return route.Parameters[parameterInfo.Name];
        }
开发者ID:AsenTahchiyski,项目名称:SoftUni,代码行数:9,代码来源:Engine.cs

示例14: MapParameters

        private static object[] MapParameters(IRoute route, MethodInfo action)
        {
            var result = action
                .GetParameters()
                .Select(parameterInfo =>
                    CheckParameter(route, parameterInfo)).ToArray();

            return result;
        }
开发者ID:AsenTahchiyski,项目名称:SoftUni,代码行数:9,代码来源:Engine.cs

示例15: RouteEquals

        public static bool RouteEquals(this IRoute r1, IRoute r2)
        {
            if (r1.Resource != r2.Resource)
                return false;
            if (r1.Action != r2.Action)
                return false;

            return true;
        }
开发者ID:RookieOne,项目名称:Chimera,代码行数:9,代码来源:IRouteExtensions.cs


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