示例#1
0
    private void OnAccountStatusComplete(CKAccountStatus accountStatus, NSError error)
    {
        if (error != null)
        {
            Debug.LogError(error.LocalizedDescription);
        }
        else
        {
            // Since AccoutStatuWithCompletionHandler is invoked everytime the Notification is sent
            // and the notification is sent for many reasons. You may want to check to see that the
            // account status has actually changed...

            // Compare the account status value against a cached version

            if (accountStatus != currentAccountStatus)
            {
                CKAccountStatus?oldAccountStatus = currentAccountStatus;
                currentAccountStatus = accountStatus;
                Debug.Log(string.Format("Account status changed from '{0}' to '{1}'", oldAccountStatus, currentAccountStatus));
            }
        }
    }
示例#2
0
        private static void AccountStatusWithCompletionHandlerCallback(IntPtr thisPtr, ulong invocationId, CKAccountStatus accountStatus, IntPtr error)
        {
            var invocation       = new InvocationRecord(thisPtr, invocationId);
            var executionContext = AccountStatusWithCompletionHandlerCallbacks[invocation];

            AccountStatusWithCompletionHandlerCallbacks.Remove(invocation);

            executionContext.Invoke(
                accountStatus,
                error == IntPtr.Zero ? null : new NSError(error));
        }
示例#3
0
        private static void AccountStatusWithCompletionHandlerCallback(IntPtr thisPtr, ulong invocationId, CKAccountStatus accountStatus, IntPtr error)
        {
            var invocation = new InvocationRecord(thisPtr, invocationId);
            var callback   = AccountStatusWithCompletionHandlerCallbacks[invocation];

            AccountStatusWithCompletionHandlerCallbacks.Remove(invocation);

            Dispatcher.Instance.EnqueueOnMainThread(() =>
                                                    callback(
                                                        accountStatus,
                                                        error == IntPtr.Zero ? null : new NSError(error)));
        }