本文整理汇总了C#中IRoute类的典型用法代码示例。如果您正苦于以下问题:C# IRoute类的具体用法?C# IRoute怎么用?C# IRoute使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IRoute类属于命名空间,在下文中一共展示了IRoute类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: CalculateBestPlacement
/// <summary>
/// Returns the customer that least increases the length of the given route.
/// </summary>
/// <param name="problem"></param>
/// <param name="route"></param>
/// <param name="customers"></param>
/// <returns></returns>
public static CheapestInsertionResult CalculateBestPlacement(
IProblemWeights problem,
IRoute route,
ICollection<int> customers)
{
IInsertionCosts costs = new BinaryHeapInsertionCosts();
return CheapestInsertionHelper.CalculateBestPlacement(problem, route, customers, costs);
}
开发者ID:jorik041,项目名称:osmsharp,代码行数:16,代码来源:CheapestInsertionHelper.cs
示例17: Execute
public IRouteResult Execute(IRoute route)
{
var method = GetMethod(route);
var parameters = GetParameters(route, method);
object result = method.Invoke(this, parameters);
return CreateRoute(result, route);
}
开发者ID:RookieOne,项目名称:Chimera,代码行数:10,代码来源:Controller.cs
示例18: Process
public IRouteResult Process(IRoute route)
{
var view = route[KnownParameters.View];
var showAs = route[KnownParameters.ShowAs].ToString();
var next = new Route("show", showAs)
.AddParameter(KnownParameters.View, view);
return new RouteResult(route).Next(next);
}
开发者ID:RookieOne,项目名称:Chimera,代码行数:10,代码来源:ViewPresenterProcessor.cs
示例19: AddRoute
public IRouteTable AddRoute(IRoute route)
{
if (route == null)
{
throw new ArgumentNullException("route");
}
routes.Add(route);
return this;
}
开发者ID:anishpateluk,项目名称:mezm.owin.razor,代码行数:10,代码来源:RouteTable.cs
示例20: GetRouteReturnsCorrectRoute
public void GetRouteReturnsCorrectRoute([Frozen]Mock<IRouteAlgorithmFactory> factoryStub, Mock<IRouteAlgorithm> routeAlgorithmStub, RouteSpecification specification, RouteType selectedAlgorithm, IRoute expectedResult, RouteController sut)
{
// Fixture setup
factoryStub.Setup(f => f.CreateAlgorithm(selectedAlgorithm)).Returns(routeAlgorithmStub.Object);
routeAlgorithmStub.Setup(a => a.CalculateRoute(specification)).Returns(expectedResult);
// Exercise system
var result = sut.GetRoute(specification, selectedAlgorithm);
// Verify outcome
Assert.Equal(expectedResult, result);
// Teardown
}
开发者ID:mesta1,项目名称:dli.net_sourcecode,代码行数:11,代码来源:RouteControllerTest.cs
注:本文中的IRoute类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论