private ILocalNotificationActionRegistrar WithUniqueActionHandler(string actionId, Action <LocalNotificationArgs> action)
        {
            RegisteredActions.RemoveAll(a => a.ActionId == actionId);
            RegisteredActions.Add(new LocalNotificationActionRegistration
            {
                ActionSetId = ActionSetId,
                ActionId    = actionId,
                Action      = action
            });

            return(this);
        }
        public void Register()
        {
            var actions = RegisteredActions
                          .OfType <ButtonLocalNotificationActionRegistration>()
                          .Select(action => UNNotificationAction.FromIdentifier(action.Id, action.Title, UNNotificationActionOptions.None))
                          .ToArray();

            var category = UNNotificationCategory.FromIdentifier(
                ActionSetId,
                actions,
                new string[] { },
                UNNotificationCategoryOptions.CustomDismissAction);

            UNUserNotificationCenter.Current.SetNotificationCategories(new NSSet <UNNotificationCategory>(category));
            LocalNotifications.Initialize();
        }
        public ILocalNotificationActionRegistrar WithActionHandler(string title, Action <LocalNotificationArgs> action)
        {
            if (RegisteredActions.OfType <ButtonLocalNotificationActionRegistration>().Any(a => a.Title == title))
            {
                throw new InvalidOperationException($"Could not register action {title} into action set {ActionSetId} because one has with the same name has already been registered");
            }

            RegisteredActions.Add(new ButtonLocalNotificationActionRegistration
            {
                ActionSetId = ActionSetId,
                ActionId    = title,
                Title       = title,
                Action      = action,
            });

            return(this);
        }
Ejemplo n.º 4
0
        public bool RegisterInputAction(Action action, string name, string description, string category)
        {
            if (RegisteredActions.Any(ia => ia.Name == name))
            {
                return(false);
            }

            RegisteredActions.Add(new InputAction
            {
                Name        = name,
                Description = description,
                Category    = category,
                Action      = action
            });

            return(true);
        }
Ejemplo n.º 5
0
 public void Init()
 {
     RegisteredActions.Clear();
 }