private static Type GetType(string className) { Type type = null; // Check in TouchToolkit assembly (GestureProcessor) Gesture g = new Gesture(); var types = g.GetType().Assembly.GetTypes(); type = GetType(className, type, types); // If not found, check in application assembly if (type == null) { types = GestureFramework.HostAssembly.GetTypes(); type = GetType(className, type, types); } return type; }
public static List<IPrimitiveConditionData> GetAllPrimitives() { List<IPrimitiveConditionData> primitives = new List<IPrimitiveConditionData>() ; // Find all classes in "Gestures" assembly that implements IRuleValidator interface Gesture g = new Gesture(); var types = g.GetType().Assembly.GetTypes(); IPrimitiveConditionData primitiveData; foreach (Type t in types) { if (t.IsTypeOf(typeof(IPrimitiveConditionData))) { primitiveData = GetPrimitiveByTypeName(t.Name); primitives.Add(primitiveData); } } return primitives; }
/// <summary> /// Returns all unique rules defined in the "Gestures" assembly /// </summary> /// <returns></returns> public static List<Type> GetAllRules() { if (_allRules.Count == 0) { // Find all classes in "Gestures" assembly that implements IRuleValidator interface Gesture g = new Gesture(); var types = g.GetType().Assembly.GetTypes(); foreach (Type t in types) { if (t.IsTypeOf(typeof(IPrimitiveConditionValidator))) _allRules.Add(t); } } return _allRules; }