private object CreateObservableController(CefRequest request) { var controllerData = GetPostData <CreateController>(request); ObservableControllerDescription observableControllerDescription = null; BaseMainApplication.Current.InvokeOnMain(() => { var observableController = BaseMainApplication.Current.Window.CreateObservableController(controllerData.Name); observableControllerDescription = observableController.GetObservableControllerDescription(); // camel case property and method names foreach (var property in observableControllerDescription.Properties) { property.Name = StringUtility.CamelCase(property.Name); } foreach (var method in observableControllerDescription.Methods) { method.Name = StringUtility.CamelCase(method.Name); } }); return(observableControllerDescription); }
/// <summary> /// Finds the method. /// </summary> /// <param name="methodName">Name of the method.</param> /// <param name="internalMethod">if set to <c>true</c> [internal method].</param> /// <returns></returns> private ControllerMethod FindMethod(string methodName, bool internalMethod) { var methods = internalMethod ? ControllerTypeInfo.InternalMethods : ControllerTypeInfo.Methods; ControllerMethod method = null; if (methods.TryGetValue(methodName, out method)) { return(method); } if (methods.TryGetValue(StringUtility.PascalCase(methodName), out method)) { return(method); } if (methods.TryGetValue(StringUtility.CamelCase(methodName), out method)) { return(method); } return(null); }
private object CreateController(CefRequest request) { var controllerData = GetPostData <CreateController>(request); ControllerDescription controllerDescription = null; BaseMainApplication.Current.InvokeOnMain(() => { var controller = BaseMainApplication.Current.Window.CreateController(controllerData.Name); controllerDescription = controller.GetControllerDescription(); // camel case method names foreach (var method in controllerDescription.Methods) { method.Name = StringUtility.CamelCase(method.Name); } }); return(controllerDescription); }
/// <summary> /// Finds the property. /// </summary> /// <param name="propertyName">Name of the property.</param> /// <returns></returns> private ControllerProperty FindProperty(string propertyName) { ControllerProperty property = null; if (ObservableControllerTypeInfo.Properties.TryGetValue(propertyName, out property)) { return(property); } if (ObservableControllerTypeInfo.Properties.TryGetValue(StringUtility.PascalCase(propertyName), out property)) { return(property); } if (ObservableControllerTypeInfo.Properties.TryGetValue(StringUtility.CamelCase(propertyName), out property)) { return(property); } return(null); }
/// <summary> /// Finds the native method. /// </summary> /// <param name="methodName">Name of the method.</param> /// <returns></returns> private Func <CefRequest, object> FindNativeMethod(string methodName) { Func <CefRequest, object> nativeMethod = null; if (NativeFunctions.TryGetValue(methodName, out nativeMethod)) { return(nativeMethod); } if (NativeFunctions.TryGetValue(StringUtility.PascalCase(methodName), out nativeMethod)) { return(nativeMethod); } if (NativeFunctions.TryGetValue(StringUtility.CamelCase(methodName), out nativeMethod)) { return(nativeMethod); } return(null); }
private NativeFunctionDelegate FindNativeFunction(string name) { NativeFunctionDelegate nativeFunction = null; if (NativeFunctions.TryGetValue(name, out nativeFunction)) { return(nativeFunction); } if (NativeFunctions.TryGetValue(StringUtility.PascalCase(name), out nativeFunction)) { return(nativeFunction); } if (NativeFunctions.TryGetValue(StringUtility.CamelCase(name), out nativeFunction)) { return(nativeFunction); } return(null); }