Пример #1
0
        public void Initialize(bool ForceLegacy)
        {
            ThrowIfDisposed();
            if (_library != null)
            {
                return;
            }

            var library = LoadLibrary(ForceLegacy);

            if (library.IsLegacy)
            {
                var libraryFunctions = LoadEntryPointsLegacy(library);
                var functions        = new AccessBridgeNativeFunctionsLegacy(libraryFunctions);
                var events           = new AccessBridgeNativeEventsLegacy(libraryFunctions);

                // Everything is initialized correctly, save to member variables.
                _library   = library;
                _functions = functions;
                _events    = events;
            }
            else
            {
                var libraryFunctions = LoadEntryPoints(library);
                var functions        = new AccessBridgeNativeFunctions(libraryFunctions);
                var events           = new AccessBridgeNativeEvents(libraryFunctions);

                // Everything is initialized correctly, save to member variables.
                _library   = library;
                _functions = functions;
                _events    = events;
            }
            _functions.Windows_run();
            OnInitilized();
        }
Пример #2
0
        public void Dispose()
        {
            if (_disposed)
            {
                return;
            }

            if (_events != null)
            {
                _events.Dispose();
            }

            if (_library != null)
            {
                _library.Dispose();
                _functions = null;
                _library   = null;
            }

            _disposed = true;
            OnDisposed();
        }