示例#1
0
        public static void RegisterCallback(int index, IntPtr function)
        {
            switch (index)
            {
            case IDE_GET_PREF_AS_STRING:
                getPrefCallback = (IdeGetPrefAsString)Marshal.GetDelegateForFunctionPointer(function, typeof(IdeGetPrefAsString));
                break;

            case IDE_GET_PERSONAL_PREF_SETS:
                getPrefSetsCallback = (IdeGetPersonalPrefSets)Marshal.GetDelegateForFunctionPointer(function, typeof(IdeGetPersonalPrefSets));
                break;

            case IDE_GET_PREF_AS_BOOL:
                getBoolPrefCallback = (IdeGetPrefAsBool)Marshal.GetDelegateForFunctionPointer(function, typeof(IdeGetPrefAsBool));
                break;

            case IDE_EXECUTE_TEMPLATE:
                execTemplateCallback = (IdeExecuteTemplate)Marshal.GetDelegateForFunctionPointer(function, typeof(IdeExecuteTemplate));
                break;

            case IDE_GET_TEXT:
                getTextCallback = (IdeGetText)Marshal.GetDelegateForFunctionPointer(function, typeof(IdeGetText));
                break;

            case IDE_SET_TEXT:
                setTextCallback = (IdeSetText)Marshal.GetDelegateForFunctionPointer(function, typeof(IdeSetText));
                break;

            case IDE_GET_CURSOR_X:
                getCursorXCallback = (IdeGetCursorX)Marshal.GetDelegateForFunctionPointer(function, typeof(IdeGetCursorX));
                break;

            case IDE_GET_CURSOR_Y:
                getCursorYCallback = (IdeGetCursorY)Marshal.GetDelegateForFunctionPointer(function, typeof(IdeGetCursorY));
                break;

            case IDE_SET_CURSOR:
                setCursorCallback = (IdeSetCursor)Marshal.GetDelegateForFunctionPointer(function, typeof(IdeSetCursor));
                break;

            case IDE_GET_READ_ONLY:
                getReadOnlyCallback = (IdeGetReadOnly)Marshal.GetDelegateForFunctionPointer(function, typeof(IdeGetReadOnly));
                break;

            case IDE_GET_GENERAL_PREF:
                getGeneralPrefCallback = (IdeGetGeneralPref)Marshal.GetDelegateForFunctionPointer(function, typeof(IdeGetGeneralPref));
                break;
            }
        }
        public static void RegisterCallback(int index, IntPtr function)
        {
            switch (index)
            {
            case CallbackIndexes.SYS_VERSION:
                sysVersion = Marshal.GetDelegateForFunctionPointer <SysVersion>(function);
                break;

            case CallbackIndexes.IDE_CREATE_WINDOW:
                createWindowCallback = Marshal.GetDelegateForFunctionPointer <IdeCreateWindow>(function);
                break;

            case CallbackIndexes.IDE_SET_TEXT:
                setTextCallback = Marshal.GetDelegateForFunctionPointer <IdeSetText>(function);
                break;

            case CallbackIndexes.IDE_GET_CONNECTION_INFO:
                getConnectionInfo = Marshal.GetDelegateForFunctionPointer <IdeGetConnectionInfo>(function);
                break;

            case CallbackIndexes.IDE_GET_WINDOW_TYPE:
                getWindowType = Marshal.GetDelegateForFunctionPointer <IdeGetWindowType>(function);
                break;

            case CallbackIndexes.IDE_SET_STATUS_MESSAGE:
                setStatusMessage = Marshal.GetDelegateForFunctionPointer <IdeSetStatusMessage>(function);
                break;

            case CallbackIndexes.IDE_FILENAME:
                func_IdeFilename = Marshal.GetDelegateForFunctionPointer <IdeFilename>(function);
                break;

            case CallbackIndexes.IDE_GET_WINDOW_OBJECT:
                ideGetWindowObject = Marshal.GetDelegateForFunctionPointer <IdeGetWindowObject>(function);
                break;

            case CallbackIndexes.IDE_GET_CURSOR_X:
                ideGetCursorColumn = Marshal.GetDelegateForFunctionPointer <IdeGetCursorX>(function);
                break;

            case CallbackIndexes.IDE_GET_CURSOR_Y:
                ideGetCursorLine = Marshal.GetDelegateForFunctionPointer <IdeGetCursorY>(function);
                break;
            }
        }