コード例 #1
0
        /// <summary>
        /// </summary>
        /// <param name="zone"></param><param name="completionHandler"></param>
        /// <returns>void</returns>
        public void SaveRecordZone(
            CKRecordZone zone,
            Action <CKRecordZone, NSError> completionHandler)
        {
            if (zone == null)
            {
                throw new ArgumentNullException(nameof(zone));
            }


            var completionHandlerCall = new InvocationRecord(Handle);

            SaveRecordZoneCallbacks[completionHandlerCall] = new ExecutionContext <CKRecordZone, NSError>(completionHandler);

            CKDatabase_saveRecordZone_completionHandler(
                Handle,
                zone != null ? HandleRef.ToIntPtr(zone.Handle) : IntPtr.Zero,

                completionHandlerCall.id, SaveRecordZoneCallback,
                out IntPtr exceptionPtr);

            if (exceptionPtr != IntPtr.Zero)
            {
                var nativeException = new NSException(exceptionPtr);
                throw new CloudKitException(nativeException, nativeException.Reason);
            }
        }
コード例 #2
0
        /// <summary>
        /// </summary>
        /// <param name="query"></param><param name="zoneID"></param><param name="completionHandler"></param>
        /// <returns>void</returns>
        public void PerformQuery(
            CKQuery query,
            CKRecordZoneID zoneID,
            Action <CKRecord[], NSError> completionHandler)
        {
            if (query == null)
            {
                throw new ArgumentNullException(nameof(query));
            }



            var completionHandlerCall = new InvocationRecord(Handle);

            PerformQueryCallbacks[completionHandlerCall] = completionHandler;

            CKDatabase_performQuery_inZoneWithID_completionHandler(
                Handle,
                query != null ? HandleRef.ToIntPtr(query.Handle) : IntPtr.Zero,

                zoneID != null ? HandleRef.ToIntPtr(zoneID.Handle) : IntPtr.Zero,

                completionHandlerCall.id, PerformQueryCallback,
                out IntPtr exceptionPtr);

            if (exceptionPtr != IntPtr.Zero)
            {
                var nativeException = new NSException(exceptionPtr);
                throw new CloudKitException(nativeException, nativeException.Reason);
            }
        }
コード例 #3
0
        /// <summary>
        /// </summary>
        /// <param name="recordID"></param><param name="completionHandler"></param>
        /// <returns>void</returns>
        public void FetchRecordWithID(
            CKRecordID recordID,
            Action <CKRecord, NSError> completionHandler)
        {
            if (recordID == null)
            {
                throw new ArgumentNullException(nameof(recordID));
            }


            var completionHandlerCall = new InvocationRecord(Handle);

            FetchRecordWithIDCallbacks[completionHandlerCall] = new ExecutionContext <CKRecord, NSError>(completionHandler);

            CKDatabase_fetchRecordWithID_completionHandler(
                Handle,
                recordID != null ? HandleRef.ToIntPtr(recordID.Handle) : IntPtr.Zero,

                completionHandlerCall.id, FetchRecordWithIDCallback,
                out IntPtr exceptionPtr);

            if (exceptionPtr != IntPtr.Zero)
            {
                var nativeException = new NSException(exceptionPtr);
                throw new CloudKitException(nativeException, nativeException.Reason);
            }
        }
コード例 #4
0
        /// <summary>
        /// </summary>
        /// <param name="zoneID"></param><param name="completionHandler"></param>
        /// <returns>void</returns>
        public void DeleteRecordZoneWithID(
            CKRecordZoneID zoneID,
            Action <CKRecordZoneID, NSError> completionHandler)
        {
            if (zoneID == null)
            {
                throw new ArgumentNullException(nameof(zoneID));
            }


            var completionHandlerCall = new InvocationRecord(Handle);

            DeleteRecordZoneWithIDCallbacks[completionHandlerCall] = completionHandler;

            CKDatabase_deleteRecordZoneWithID_completionHandler(
                Handle,
                zoneID != null ? HandleRef.ToIntPtr(zoneID.Handle) : IntPtr.Zero,

                completionHandlerCall.id, DeleteRecordZoneWithIDCallback,
                out IntPtr exceptionPtr);

            if (exceptionPtr != IntPtr.Zero)
            {
                var nativeException = new NSException(exceptionPtr);
                throw new CloudKitException(nativeException, nativeException.Reason);
            }
        }
コード例 #5
0
        /// <summary>
        /// </summary>
        /// <param name="metadata"></param><param name="completionHandler"></param>
        /// <returns>void</returns>
        public void AcceptShareMetadata(
            CKShareMetadata metadata,
            Action <CKShare, NSError> completionHandler)
        {
            if (metadata == null)
            {
                throw new ArgumentNullException(nameof(metadata));
            }


            var completionHandlerCall = new InvocationRecord(Handle);

            AcceptShareMetadataCallbacks[completionHandlerCall] = new ExecutionContext <CKShare, NSError>(completionHandler);

            CKContainer_acceptShareMetadata_completionHandler(
                Handle,
                metadata != null ? HandleRef.ToIntPtr(metadata.Handle) : IntPtr.Zero,

                completionHandlerCall.id, AcceptShareMetadataCallback,
                out IntPtr exceptionPtr);

            if (exceptionPtr != IntPtr.Zero)
            {
                var nativeException = new NSException(exceptionPtr);
                throw new CloudKitException(nativeException, nativeException.Reason);
            }
        }
コード例 #6
0
        /// <summary>
        /// </summary>
        /// <param name="emailAddress"></param><param name="completionHandler"></param>
        /// <returns>void</returns>
        public void FetchShareParticipantWithEmailAddress(
            string emailAddress,
            Action <CKShareParticipant, NSError> completionHandler)
        {
            if (emailAddress == null)
            {
                throw new ArgumentNullException(nameof(emailAddress));
            }


            var completionHandlerCall = new InvocationRecord(Handle);

            FetchShareParticipantWithEmailAddressCallbacks[completionHandlerCall] = completionHandler;

            CKContainer_fetchShareParticipantWithEmailAddress_completionHandler(
                Handle,
                emailAddress,

                completionHandlerCall.id, FetchShareParticipantWithEmailAddressCallback,
                out IntPtr exceptionPtr);

            if (exceptionPtr != IntPtr.Zero)
            {
                var nativeException = new NSException(exceptionPtr);
                throw new CloudKitException(nativeException, nativeException.Reason);
            }
        }
コード例 #7
0
        /// <summary>
        /// </summary>
        /// <param name="subscription"></param><param name="completionHandler"></param>
        /// <returns>void</returns>
        public void SaveSubscription(
            CKSubscription subscription,
            Action <CKSubscription, NSError> completionHandler)
        {
            if (subscription == null)
            {
                throw new ArgumentNullException(nameof(subscription));
            }


            var completionHandlerCall = new InvocationRecord(Handle);

            SaveSubscriptionCallbacks[completionHandlerCall] = completionHandler;

            CKDatabase_saveSubscription_completionHandler(
                Handle,
                subscription != null ? HandleRef.ToIntPtr(subscription.Handle) : IntPtr.Zero,

                completionHandlerCall.id, SaveSubscriptionCallback,
                out IntPtr exceptionPtr);

            if (exceptionPtr != IntPtr.Zero)
            {
                var nativeException = new NSException(exceptionPtr);
                throw new CloudKitException(nativeException, nativeException.Reason);
            }
        }
コード例 #8
0
        /// <summary>
        /// </summary>
        /// <param name="operationID"></param><param name="completionHandler"></param>
        /// <returns>void</returns>
        public void FetchLongLivedOperationWithID(
            string operationID,
            Action <CKOperation, NSError> completionHandler)
        {
            if (operationID == null)
            {
                throw new ArgumentNullException(nameof(operationID));
            }


            var completionHandlerCall = new InvocationRecord(Handle);

            FetchLongLivedOperationWithIDCallbacks[completionHandlerCall] = new ExecutionContext <CKOperation, NSError>(completionHandler);

            CKContainer_fetchLongLivedOperationWithID_completionHandler(
                Handle,
                operationID,

                completionHandlerCall.id, FetchLongLivedOperationWithIDCallback,
                out IntPtr exceptionPtr);

            if (exceptionPtr != IntPtr.Zero)
            {
                var nativeException = new NSException(exceptionPtr);
                throw new CloudKitException(nativeException, nativeException.Reason);
            }
        }
コード例 #9
0
        /// <summary>
        /// </summary>
        /// <param name="subscriptionID"></param><param name="completionHandler"></param>
        /// <returns>void</returns>
        public void DeleteSubscriptionWithID(
            string subscriptionID,
            Action <string, NSError> completionHandler)
        {
            if (subscriptionID == null)
            {
                throw new ArgumentNullException(nameof(subscriptionID));
            }


            var completionHandlerCall = new InvocationRecord(Handle);

            DeleteSubscriptionWithIDCallbacks[completionHandlerCall] = completionHandler;

            CKDatabase_deleteSubscriptionWithID_completionHandler(
                Handle,
                subscriptionID,

                completionHandlerCall.id, DeleteSubscriptionWithIDCallback,
                out IntPtr exceptionPtr);

            if (exceptionPtr != IntPtr.Zero)
            {
                var nativeException = new NSException(exceptionPtr);
                throw new CloudKitException(nativeException, nativeException.Reason);
            }
        }
コード例 #10
0
        /// <summary>
        /// </summary>
        /// <param name="url"></param><param name="completionHandler"></param>
        /// <returns>void</returns>
        public void FetchShareMetadataWithURL(
            NSURL url,
            Action <CKShareMetadata, NSError> completionHandler)
        {
            if (url == null)
            {
                throw new ArgumentNullException(nameof(url));
            }


            var completionHandlerCall = new InvocationRecord(Handle);

            FetchShareMetadataWithURLCallbacks[completionHandlerCall] = new ExecutionContext <CKShareMetadata, NSError>(completionHandler);

            CKContainer_fetchShareMetadataWithURL_completionHandler(
                Handle,
                url != null ? HandleRef.ToIntPtr(url.Handle) : IntPtr.Zero,

                completionHandlerCall.id, FetchShareMetadataWithURLCallback,
                out IntPtr exceptionPtr);

            if (exceptionPtr != IntPtr.Zero)
            {
                var nativeException = new NSException(exceptionPtr);
                throw new CloudKitException(nativeException, nativeException.Reason);
            }
        }
コード例 #11
0
        /// <summary>
        /// </summary>
        /// <param name="userRecordID"></param><param name="completionHandler"></param>
        /// <returns>void</returns>
        public void FetchShareParticipantWithUserRecordID(
            CKRecordID userRecordID,
            Action <CKShareParticipant, NSError> completionHandler)
        {
            if (userRecordID == null)
            {
                throw new ArgumentNullException(nameof(userRecordID));
            }


            var completionHandlerCall = new InvocationRecord(Handle);

            FetchShareParticipantWithUserRecordIDCallbacks[completionHandlerCall] = new ExecutionContext <CKShareParticipant, NSError>(completionHandler);

            CKContainer_fetchShareParticipantWithUserRecordID_completionHandler(
                Handle,
                userRecordID != null ? HandleRef.ToIntPtr(userRecordID.Handle) : IntPtr.Zero,

                completionHandlerCall.id, FetchShareParticipantWithUserRecordIDCallback,
                out IntPtr exceptionPtr);

            if (exceptionPtr != IntPtr.Zero)
            {
                var nativeException = new NSException(exceptionPtr);
                throw new CloudKitException(nativeException, nativeException.Reason);
            }
        }
コード例 #12
0
        /// <summary>
        /// </summary>
        /// <param name="phoneNumber"></param><param name="completionHandler"></param>
        /// <returns>void</returns>
        public void FetchShareParticipantWithPhoneNumber(
            string phoneNumber,
            Action <CKShareParticipant, NSError> completionHandler)
        {
            if (phoneNumber == null)
            {
                throw new ArgumentNullException(nameof(phoneNumber));
            }


            var completionHandlerCall = new InvocationRecord(Handle);

            FetchShareParticipantWithPhoneNumberCallbacks[completionHandlerCall] = new ExecutionContext <CKShareParticipant, NSError>(completionHandler);

            CKContainer_fetchShareParticipantWithPhoneNumber_completionHandler(
                Handle,
                phoneNumber,

                completionHandlerCall.id, FetchShareParticipantWithPhoneNumberCallback,
                out IntPtr exceptionPtr);

            if (exceptionPtr != IntPtr.Zero)
            {
                var nativeException = new NSException(exceptionPtr);
                throw new CloudKitException(nativeException, nativeException.Reason);
            }
        }
コード例 #13
0
        /// <summary>
        /// </summary>
        /// <param name="email"></param><param name="completionHandler"></param>
        /// <returns>void</returns>
        public void DiscoverUserIdentityWithEmailAddress(
            string email,
            Action <CKUserIdentity, NSError> completionHandler)
        {
            if (email == null)
            {
                throw new ArgumentNullException(nameof(email));
            }


            var completionHandlerCall = new InvocationRecord(Handle);

            DiscoverUserIdentityWithEmailAddressCallbacks[completionHandlerCall] = new ExecutionContext <CKUserIdentity, NSError>(completionHandler);

            CKContainer_discoverUserIdentityWithEmailAddress_completionHandler(
                Handle,
                email,

                completionHandlerCall.id, DiscoverUserIdentityWithEmailAddressCallback,
                out IntPtr exceptionPtr);

            if (exceptionPtr != IntPtr.Zero)
            {
                var nativeException = new NSException(exceptionPtr);
                throw new CloudKitException(nativeException, nativeException.Reason);
            }
        }
コード例 #14
0
        private static void FetchShareMetadataWithURLCallback(IntPtr thisPtr, ulong invocationId, IntPtr metadata, IntPtr error)
        {
            var invocation       = new InvocationRecord(thisPtr, invocationId);
            var executionContext = FetchShareMetadataWithURLCallbacks[invocation];

            FetchShareMetadataWithURLCallbacks.Remove(invocation);

            executionContext.Invoke(
                metadata == IntPtr.Zero ? null : new CKShareMetadata(metadata),
                error == IntPtr.Zero ? null : new NSError(error));
        }
コード例 #15
0
        private static void StatusForApplicationPermissionCallback(IntPtr thisPtr, ulong invocationId, CKApplicationPermissionStatus applicationPermissionsStatus, IntPtr error)
        {
            var invocation       = new InvocationRecord(thisPtr, invocationId);
            var executionContext = StatusForApplicationPermissionCallbacks[invocation];

            StatusForApplicationPermissionCallbacks.Remove(invocation);

            executionContext.Invoke(
                applicationPermissionsStatus,
                error == IntPtr.Zero ? null : new NSError(error));
        }
コード例 #16
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));
        }
コード例 #17
0
        private static void AcceptShareMetadataCallback(IntPtr thisPtr, ulong invocationId, IntPtr acceptedShare, IntPtr error)
        {
            var invocation       = new InvocationRecord(thisPtr, invocationId);
            var executionContext = AcceptShareMetadataCallbacks[invocation];

            AcceptShareMetadataCallbacks.Remove(invocation);

            executionContext.Invoke(
                acceptedShare == IntPtr.Zero ? null : new CKShare(acceptedShare),
                error == IntPtr.Zero ? null : new NSError(error));
        }
コード例 #18
0
        private static void DeleteRecordZoneWithIDCallback(IntPtr thisPtr, ulong invocationId, IntPtr recordZoneID, IntPtr error)
        {
            var invocation       = new InvocationRecord(thisPtr, invocationId);
            var executionContext = DeleteRecordZoneWithIDCallbacks[invocation];

            DeleteRecordZoneWithIDCallbacks.Remove(invocation);

            executionContext.Invoke(
                recordZoneID == IntPtr.Zero ? null : new CKRecordZoneID(recordZoneID),
                error == IntPtr.Zero ? null : new NSError(error));
        }
コード例 #19
0
        private static void FetchRecordWithIDCallback(IntPtr thisPtr, ulong invocationId, IntPtr _record, IntPtr _error)
        {
            var invocation       = new InvocationRecord(thisPtr, invocationId);
            var executionContext = FetchRecordWithIDCallbacks[invocation];

            FetchRecordWithIDCallbacks.Remove(invocation);

            executionContext.Invoke(
                _record == IntPtr.Zero ? null : new CKRecord(_record),
                _error == IntPtr.Zero ? null : new NSError(_error));
        }
コード例 #20
0
        private static void DeleteSubscriptionWithIDCallback(IntPtr thisPtr, ulong invocationId, IntPtr str, IntPtr error)
        {
            var invocation       = new InvocationRecord(thisPtr, invocationId);
            var executionContext = DeleteSubscriptionWithIDCallbacks[invocation];

            DeleteSubscriptionWithIDCallbacks.Remove(invocation);

            executionContext.Invoke(
                Marshal.PtrToStringAuto(str),
                error == IntPtr.Zero ? null : new NSError(error));
        }
コード例 #21
0
        private static void DiscoverUserIdentityWithEmailAddressCallback(IntPtr thisPtr, ulong invocationId, IntPtr userIdentity, IntPtr error)
        {
            var invocation       = new InvocationRecord(thisPtr, invocationId);
            var executionContext = DiscoverUserIdentityWithEmailAddressCallbacks[invocation];

            DiscoverUserIdentityWithEmailAddressCallbacks.Remove(invocation);

            executionContext.Invoke(
                userIdentity == IntPtr.Zero ? null : new CKUserIdentity(userIdentity),
                error == IntPtr.Zero ? null : new NSError(error));
        }
コード例 #22
0
        private static void FetchUserRecordIDWithCompletionHandlerCallback(IntPtr thisPtr, ulong invocationId, IntPtr _recordID, IntPtr _error)
        {
            var invocation       = new InvocationRecord(thisPtr, invocationId);
            var executionContext = FetchUserRecordIDWithCompletionHandlerCallbacks[invocation];

            FetchUserRecordIDWithCompletionHandlerCallbacks.Remove(invocation);

            executionContext.Invoke(
                _recordID == IntPtr.Zero ? null : new CKRecordID(_recordID),
                _error == IntPtr.Zero ? null : new NSError(_error));
        }
コード例 #23
0
        private static void FetchShareParticipantWithUserRecordIDCallback(IntPtr thisPtr, ulong invocationId, IntPtr shareParticipant, IntPtr error)
        {
            var invocation       = new InvocationRecord(thisPtr, invocationId);
            var executionContext = FetchShareParticipantWithUserRecordIDCallbacks[invocation];

            FetchShareParticipantWithUserRecordIDCallbacks.Remove(invocation);

            executionContext.Invoke(
                shareParticipant == IntPtr.Zero ? null : new CKShareParticipant(shareParticipant),
                error == IntPtr.Zero ? null : new NSError(error));
        }
コード例 #24
0
        private static void SaveSubscriptionCallback(IntPtr thisPtr, ulong invocationId, IntPtr _subscription, IntPtr _error)
        {
            var invocation       = new InvocationRecord(thisPtr, invocationId);
            var executionContext = SaveSubscriptionCallbacks[invocation];

            SaveSubscriptionCallbacks.Remove(invocation);

            executionContext.Invoke(
                _subscription == IntPtr.Zero ? null : new CKSubscription(_subscription),
                _error == IntPtr.Zero ? null : new NSError(_error));
        }
コード例 #25
0
        private static void FetchLongLivedOperationWithIDCallback(IntPtr thisPtr, ulong invocationId, IntPtr operationID, IntPtr error)
        {
            var invocation       = new InvocationRecord(thisPtr, invocationId);
            var executionContext = FetchLongLivedOperationWithIDCallbacks[invocation];

            FetchLongLivedOperationWithIDCallbacks.Remove(invocation);

            executionContext.Invoke(
                operationID == IntPtr.Zero ? null : new CKOperation(operationID),
                error == IntPtr.Zero ? null : new NSError(error));
        }
コード例 #26
0
        private static void SaveRecordZoneCallback(IntPtr thisPtr, ulong invocationId, IntPtr recordZone, IntPtr error)
        {
            var invocation       = new InvocationRecord(thisPtr, invocationId);
            var executionContext = SaveRecordZoneCallbacks[invocation];

            SaveRecordZoneCallbacks.Remove(invocation);

            executionContext.Invoke(
                recordZone == IntPtr.Zero ? null : new CKRecordZone(recordZone),
                error == IntPtr.Zero ? null : new NSError(error));
        }
コード例 #27
0
        private static void DeleteSubscriptionWithIDCallback(IntPtr thisPtr, ulong invocationId, IntPtr str, IntPtr error)
        {
            var invocation = new InvocationRecord(thisPtr, invocationId);
            var callback   = DeleteSubscriptionWithIDCallbacks[invocation];

            DeleteSubscriptionWithIDCallbacks.Remove(invocation);

            Dispatcher.Instance.EnqueueOnMainThread(() =>
                                                    callback(
                                                        Marshal.PtrToStringAuto(str),
                                                        error == IntPtr.Zero ? null : new NSError(error)));
        }
コード例 #28
0
        private static void SaveSubscriptionCallback(IntPtr thisPtr, ulong invocationId, IntPtr _subscription, IntPtr _error)
        {
            var invocation = new InvocationRecord(thisPtr, invocationId);
            var callback   = SaveSubscriptionCallbacks[invocation];

            SaveSubscriptionCallbacks.Remove(invocation);

            Dispatcher.Instance.EnqueueOnMainThread(() =>
                                                    callback(
                                                        _subscription == IntPtr.Zero ? null : new CKSubscription(_subscription),
                                                        _error == IntPtr.Zero ? null : new NSError(_error)));
        }
コード例 #29
0
        private static void FetchRecordWithIDCallback(IntPtr thisPtr, ulong invocationId, IntPtr _record, IntPtr _error)
        {
            var invocation = new InvocationRecord(thisPtr, invocationId);
            var callback   = FetchRecordWithIDCallbacks[invocation];

            FetchRecordWithIDCallbacks.Remove(invocation);

            Dispatcher.Instance.EnqueueOnMainThread(() =>
                                                    callback(
                                                        _record == IntPtr.Zero ? null : new CKRecord(_record),
                                                        _error == IntPtr.Zero ? null : new NSError(_error)));
        }
コード例 #30
0
        private static void DeleteRecordZoneWithIDCallback(IntPtr thisPtr, ulong invocationId, IntPtr recordZoneID, IntPtr error)
        {
            var invocation = new InvocationRecord(thisPtr, invocationId);
            var callback   = DeleteRecordZoneWithIDCallbacks[invocation];

            DeleteRecordZoneWithIDCallbacks.Remove(invocation);

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