예제 #1
0
파일: Route.cs 프로젝트: hongAgain/CatLib
 /// <summary>
 /// 创建一个新的路由条目
 /// </summary>
 /// <param name="url"></param>
 /// <param name="action"></param>
 public Route(Uri uri, RouteAction action)
 {
     this.uri    = uri;
     this.action = action;
     options     = new RouteOptions();
     options.OnCompiledChange += ClearCompile;
 }
예제 #2
0
        /// <summary>
        /// 产生一个路由条目
        /// </summary>
        /// <param name="uri">uri</param>
        /// <param name="action">路由行为</param>
        /// <returns>路由条目</returns>
        private Route MakeRoute(Uri uri, RouteAction action)
        {
            var route = new Route(uri, action);

            route.SetRouter(this);
            route.SetContainer(container);
            return(route);
        }
예제 #3
0
파일: Router.cs 프로젝트: tongange/CatLib
        /// <summary>
        /// 产生一个路由条目
        /// </summary>
        /// <param name="uri">uri</param>
        /// <param name="action">路由行为</param>
        /// <returns>路由条目</returns>
        private Route MakeRoute(Uri uri, RouteAction action)
        {
            var route = new Route(uri, action);

            route.SetRouter(this);
            route.SetScheme(schemes[uri.Scheme]);
            route.SetFilterChain(filterChain);
            route.SetContainer(container);
            return(route);
        }
예제 #4
0
파일: Router.cs 프로젝트: tongange/CatLib
        /// <summary>
        /// 注册一个路由方案
        /// </summary>
        /// <param name="uris">统一资源标识符</param>
        /// <param name="action">行为</param>
        /// <returns>当前实例</returns>
        private IRoute RegisterRoute(string uris, RouteAction action)
        {
            uris = GuardUri(uris);
            var uri = new Uri(uris);

            if (!schemes.ContainsKey(uri.Scheme))
            {
                CreateScheme(uri.Scheme);
            }

            var route = MakeRoute(uri, action);

            schemes[uri.Scheme].AddRoute(route);

            if (routeGroupStack.Count > 0)
            {
                routeGroupStack.Peek().AddRoute(route);
            }

            return(route);
        }
예제 #5
0
파일: Route.cs 프로젝트: tangqi1990/CatLib
 /// <summary>
 /// 创建一个新的路由条目
 /// </summary>
 /// <param name="url"></param>
 /// <param name="action"></param>
 public Route(Uri uri, RouteAction action)
 {
     this.uri    = uri;
     this.action = action;
     options     = new RouteOptions();
 }