Пример #1
0
        void FireEventPermissionCompletionHandler(ClusterEventAuthorizationType eventType)
        {
            EKAuthorizationStatus status = EKEventStore.GetAuthorizationStatus(EKEquivalentEventType(eventType));

            if (_eventPermissionCompletionHandler != null)
            {
                ClusterDialogResult userDialogResult   = ClusterDialogResult.Granted;
                ClusterDialogResult systemDialogResult = ClusterDialogResult.Granted;
                if (status == EKAuthorizationStatus.NotDetermined)
                {
                    userDialogResult   = ClusterDialogResult.Denied;
                    systemDialogResult = ClusterDialogResult.NoActionTaken;
                }
                else if (status == EKAuthorizationStatus.Authorized)
                {
                    userDialogResult   = ClusterDialogResult.Granted;
                    systemDialogResult = ClusterDialogResult.Granted;
                }
                else if (status == EKAuthorizationStatus.Denied)
                {
                    userDialogResult   = ClusterDialogResult.Granted;
                    systemDialogResult = ClusterDialogResult.Denied;
                }
                else if (status == EKAuthorizationStatus.Restricted)
                {
                    userDialogResult   = ClusterDialogResult.Granted;
                    systemDialogResult = ClusterDialogResult.ParentallyRestricted;
                }
                _eventPermissionCompletionHandler((status == EKAuthorizationStatus.Authorized),
                                                  userDialogResult,
                                                  systemDialogResult);
                _eventPermissionCompletionHandler = null;
            }
        }
Пример #2
0
        public void CheckEventStoreAccess(EKEntityType type)
        {
            EKAuthorizationStatus status = EKEventStore.GetAuthorizationStatus(type);
            DataClass             dc     = type == EKEntityType.Event ? DataClass.Calendars : DataClass.Reminders;

            switch (status)
            {
            case EKAuthorizationStatus.NotDetermined:
                ShowAlert(dc, "not determined");
                break;

            case EKAuthorizationStatus.Restricted:
                ShowAlert(dc, "restricted");
                break;

            case EKAuthorizationStatus.Denied:
                ShowAlert(dc, "denied");
                break;

            case EKAuthorizationStatus.Authorized:
                ShowAlert(dc, "granted");
                break;
            }
        }