示例#1
0
        static unsafe SharedRealmHandleExtensions()
        {
            NativeCommon.Initialize();

            NativeMethods.RefreshAccessTokenCallbackDelegate refresh = RefreshAccessTokenCallback;
            NativeMethods.SessionErrorCallback    error    = HandleSessionError;
            NativeMethods.SessionProgressCallback progress = HandleSessionProgress;
            NativeMethods.SessionWaitCallback     wait     = HandleSessionWaitCallback;

            GCHandle.Alloc(refresh);
            GCHandle.Alloc(error);
            GCHandle.Alloc(progress);
            GCHandle.Alloc(wait);

            NativeMethods.install_syncsession_callbacks(refresh, error, progress, wait);

            NativeMethods.OpenRealmCallback openRealm = HandleOpenRealmCallback;

            GCHandle.Alloc(openRealm);

            NativeMethods.install_syncmanager_callbacks(openRealm);

            _logCallback = HandleLogMessage;
            GCHandle.Alloc(_logCallback);
        }
        static unsafe SharedRealmHandleExtensions()
        {
            NativeMethods.RefreshAccessTokenCallbackDelegate refresh = RefreshAccessTokenCallback;
            NativeMethods.SessionErrorCallback    error    = HandleSessionError;
            NativeMethods.SessionProgressCallback progress = HandleSessionProgress;
            NativeMethods.SessionWaitCallback     wait     = HandleSessionWaitCallback;

            GCHandle.Alloc(refresh);
            GCHandle.Alloc(error);
            GCHandle.Alloc(progress);
            GCHandle.Alloc(wait);

            NativeMethods.install_syncsession_callbacks(refresh, error, progress, wait);
        }
 private static void InitializeSync(string basePath, NativeMethods.RefreshAccessTokenCallbackDelegate refreshCallback)
 {
     NativeMethods.initialize_sync(basePath, (IntPtr)basePath.Length, refreshCallback);
 }