Exemplo n.º 1
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);
            }
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 3
0
        public CKRecord(
            string recordType,
            CKRecordZoneID zoneID
            )
        {
            if (recordType == null)
            {
                throw new ArgumentNullException(nameof(recordType));
            }
            if (zoneID == null)
            {
                throw new ArgumentNullException(nameof(zoneID));
            }

            IntPtr ptr = CKRecord_initWithRecordType_zoneID(
                recordType,
                zoneID != null ? HandleRef.ToIntPtr(zoneID.Handle) : IntPtr.Zero,
                out IntPtr exceptionPtr);

            if (exceptionPtr != IntPtr.Zero)
            {
                var nativeException = new NSException(exceptionPtr);
                throw new CloudKitException(nativeException, nativeException.Reason);
            }

            Handle = new HandleRef(this, ptr);
        }