/**Add a route to the list of routes. * @param id The RouteID * @param type The pattern type to use * @param pattern The route pattern to match to * @param handler A lambda(or similar) to invoke a new HttpHandler, such as ()=>{return new MyHandler;} */ public void AddRoute(string id, PatternTypes type, string pattern, HandlerInvoker handler) { var r = new Route { Pattern = pattern, Handler = handler, PatternType = type, ID = id }; Routes.Add(r); }
/**Add a route to the list of routes. * @param id The RouteID * @param type The pattern type to use * @param pattern The route pattern to match to * @param handler A lambda(or similar) to invoke a new HttpHandler, such as ()=>{return new MyHandler;} */ static public void AddRoute(string id, PatternTypes type, string pattern, HandlerInvoker handler) { /**TODO: This needs to be smart enough so that routes can not be added while routes are being parsed, else get a * "collection modified" exception from .Net. **/ if (router == null) { router = new Router(); } router.AddRoute(id, type, pattern, handler); }
public Constant(PatternTypes type, dynamic value) : base(type) { Value = value; }
public Variable(PatternTypes type) : base(type) { }
protected PatternPart(PatternTypes type) { Type = type; }
/// <summary> /// Creates a new pattern with the specified type /// </summary> /// <param name="type">The subclass of pattern to use as the internal pattern</param> public Pattern(PatternTypes type) { SetType(type); }
private void SetType(PatternTypes type) { _patternType = type; IPattern result = null; switch (type) { case PatternTypes.Gradient: result = new GradientPattern(); break; case PatternTypes.Line: break; case PatternTypes.Marker: break; case PatternTypes.Picture: result = new PicturePattern(); break; case PatternTypes.Simple: result = new SimplePattern(); break; } if (result != null) result.Outline = _innerPattern.Outline; _innerPattern = result; }