Esempio n. 1
0
        internal static void OnAuthExpiration(IntPtr address)
        {
            OnAuthExpirationCallback   callback     = null;
            AuthExpirationCallbackInfo callbackInfo = null;

            if (Helper.TryGetAndRemoveCallback <OnAuthExpirationCallback, AuthExpirationCallbackInfoInternal, AuthExpirationCallbackInfo>(address, out callback, out callbackInfo))
            {
                callback(callbackInfo);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Register to receive upcoming authentication expiration notifications.
        /// Notification is approximately 10 minutes prior to expiration.
        /// Call <see cref="Login" /> again with valid third party credentials to refresh access
        ///
        /// @note must call RemoveNotifyAuthExpiration to remove the notification
        /// </summary>
        /// <param name="options">structure containing the API version of the callback to use</param>
        /// <param name="clientData">arbitrary data that is passed back to you in the callback</param>
        /// <param name="notification">a callback that is fired when the authentication is about to expire</param>
        /// <returns>
        /// handle representing the registered callback
        /// </returns>
        public ulong AddNotifyAuthExpiration(AddNotifyAuthExpirationOptions options, object clientData, OnAuthExpirationCallback notification)
        {
            var optionsInternal = Helper.CopyProperties <AddNotifyAuthExpirationOptionsInternal>(options);

            var notificationInternal = new OnAuthExpirationCallbackInternal(OnAuthExpiration);
            var clientDataAddress    = IntPtr.Zero;

            Helper.AddCallback(ref clientDataAddress, clientData, notification, notificationInternal);

            var funcResult = EOS_Connect_AddNotifyAuthExpiration(InnerHandle, ref optionsInternal, clientDataAddress, notificationInternal);

            Helper.TryMarshalDispose(ref optionsInternal);

            Helper.TryAssignNotificationIdToCallback(clientDataAddress, funcResult);

            var funcResultReturn = Helper.GetDefault <ulong>();

            Helper.TryMarshalGet(funcResult, out funcResultReturn);
            return(funcResultReturn);
        }