Exemple #1
0
        private async Task EditAsync(int itemId)
        {
            await _dialog.ShowBusy();

            Model.Entity entity = await Task.Run(() => _service.GetByIdAsync(itemId));

            await _dialog.HideBusy();

            ValidationSummary = string.Empty;
            EditItem          = new EntityObservable(entity, _service);
        }
Exemple #2
0
        private async Task LoadAsync(bool resetEntry = true)
        {
            await _dialog.ShowBusy();

            List <Model.Entity> entities = await Task.Run(() => _service.AllAsync());

            await _dialog.HideBusy();

            Items = new ObservableCollection <EntityObservable>(entities.Select(e => new EntityObservable(e, _service)));

            if (resetEntry)
            {
                ValidationSummary = string.Empty;
                EditItem          = new EntityObservable(_service);
            }
        }
Exemple #3
0
 public ProfileLocationSubscriptions(IEntityObjectEventService eventService)
 {
     _eventService = eventService;
     _eventService.EntityObjectEvent += EventService_OnEntityObjectEvent;
     #region Group
     AddField(new EventStreamFieldType
     {
         Name        = "group_OnInsert",
         Description = "Raises when a new Group has been inserted",
         Type        = typeof(GroupType),
         Resolver    = new FuncFieldResolver <Group>(context => context.Source as Group),
         Subscriber  = new EventStreamResolver <Group>(context => _groupInsertObservable)
     });
     AddField(new EventStreamFieldType
     {
         Name        = "group_OnChange",
         Description = "Raises when a any update/change to an existing Group",
         Type        = typeof(GroupType),
         Resolver    = new FuncFieldResolver <Group>(context => context.Source as Group),
         Subscriber  = new EventStreamResolver <Group>(context => _groupChangeObservable)
     });
     AddField(new EventStreamFieldType
     {
         Name        = "group_OnUpdate",
         Description = "Raises when specified ID Group has been updated",
         Arguments   = new QueryArguments(new QueryArgument <NonNullGraphType <IntGraphType> >()
         {
             Name = "Id", Description = "Key of object to receive updates from"
         }),
         Type       = typeof(GroupType),
         Resolver   = new FuncFieldResolver <Group>(context => context.Source as Group),
         Subscriber = new EventStreamResolver <Group>(context =>
         {
             var id = context.GetArgument <int>("id");
             if (_groupUpdateObservables.TryGetValue(id, out var observable))
             {
                 return(observable);
             }
             observable = new EntityObservable <Group>(() => _groupUpdateObservables.Remove(id));
             _groupUpdateObservables[id] = observable;
             return(observable);
         })
     });