Ejemplo n.º 1
0
        /// <summary>
        /// </summary>
        /// <param name="record"></param><param name="completionHandler"></param>
        /// <returns>void</returns>
        public void SaveRecord(
            CKRecord record,
            Action <CKRecord, NSError> completionHandler)
        {
            if (record == null)
            {
                throw new ArgumentNullException(nameof(record));
            }


            var completionHandlerCall = new InvocationRecord(Handle);

            SaveRecordCallbacks[completionHandlerCall] = completionHandler;

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

                completionHandlerCall.id, SaveRecordCallback,
                out IntPtr exceptionPtr);

            if (exceptionPtr != IntPtr.Zero)
            {
                var nativeException = new NSException(exceptionPtr);
                throw new CloudKitException(nativeException, nativeException.Reason);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// </summary>
        /// <param name="parentRecord"></param>
        /// <returns>void</returns>
        public void SetParentReferenceFromRecord(
            CKRecord parentRecord)
        {
            CKRecord_setParentReferenceFromRecord(
                Handle,
                parentRecord != null ? HandleRef.ToIntPtr(parentRecord.Handle) : IntPtr.Zero,
                out IntPtr exceptionPtr);

            if (exceptionPtr != IntPtr.Zero)
            {
                var nativeException = new NSException(exceptionPtr);
                throw new CloudKitException(nativeException, nativeException.Reason);
            }
        }
Ejemplo n.º 3
0
        public CKShare(
            CKRecord rootRecord
            )
        {
            IntPtr ptr = CKShare_initWithRootRecord(
                rootRecord != null ? HandleRef.ToIntPtr(rootRecord.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);
        }
        public CKReference(
            CKRecord record,
            CKReferenceAction action
            )
        {
            if (record == null)
            {
                throw new ArgumentNullException(nameof(record));
            }

            IntPtr ptr = CKReference_initWithRecord_action(
                record != null ? HandleRef.ToIntPtr(record.Handle) : IntPtr.Zero,
                (long)action,
                out IntPtr exceptionPtr);

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

            Handle = new HandleRef(this, ptr);
        }