/// <summary>
        /// Update a list of applications from a received event
        /// </summary>
        /// <param name="results"></param>
        /// <param name="ev"></param>
        public static void Update(this IList <ApplicationInfoApiModel> results,
                                  ApplicationEventApiModel ev)
        {
            var application = results.FirstOrDefault(e => e.ApplicationId == ev.Id);

            if (application == null &&
                ev.EventType != ApplicationEventType.New)
            {
                return;
            }
            switch (ev.EventType)
            {
            case ApplicationEventType.New:
                if (application == null)
                {
                    // Add if not already in list
                    results.Add(ev.Application);
                }
                break;

            case ApplicationEventType.Enabled:
            case ApplicationEventType.Updated:
            case ApplicationEventType.Disabled:
                ev.Application.Patch(application);
                break;

            case ApplicationEventType.Deleted:
                results.Remove(application);
                break;
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Action on ApplicationEvent
 /// </summary>
 /// <param name="ev"></param>
 private Task ApplicationEvent(ApplicationEventApiModel ev)
 {
     Items.Results.Update(ev);
     CheckErrorOrEmpty();
     StateHasChanged();
     return(Task.CompletedTask);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Action on ApplicationEvent
 /// </summary>
 /// <param name="ev"></param>
 private Task ApplicationEvent(ApplicationEventApiModel ev)
 {
     ApplicationList.Results.Update(ev);
     _pagedApplicationList = ApplicationList.GetPaged(int.Parse(Page), CommonHelper.PageLength, ApplicationList.Error);
     CommonHelper.CheckErrorOrEmpty(_pagedApplicationList, ref _tableView, ref _tableEmpty);
     StateHasChanged();
     return(Task.CompletedTask);
 }