Esempio n. 1
0
        public virtual bool IsContentUpdateAppliable(IContentUpdate <ContentType> update)
        {
            var args = new ContentUpdatingEventArgs <ContentType>(update);

            OnContainerUpdating(args);
            return(!args.Handled);
        }
Esempio n. 2
0
        public virtual async Task ApplyContentUpdateByAsync(IContentUpdate <ContentType> update)
        {
            BeginWork();
            await Task.Yield();

            try {
                await update.ContentTask;

                if (IsContentUpdateAppliable(update))
                {
                    await UpdateContentByAsync(update);

                    var args = new ContentUpdatedEventArgs <ContentType>(update);
                    OnContainerUpdated(args);
                    //return true;
                }
            } finally {
                EndWork();
            }

            //return false;
        }
 public ContentUpdatedEventArgs(IContentUpdate <ContentType> update)
 => Update = update;
Esempio n. 4
0
 protected override async Task UpdateContentByAsync(IContentUpdate <DeviceHeaderEntity> update)
 {
     Header = await update.ContentTask;
     var stateUpdate = update.CreateUpdateFromContent(_ => Header.State, this);
     await StateContainer.ApplyContentUpdateByAsync(stateUpdate);
 }
Esempio n. 5
0
        protected override async Task UpdateContentByAsync(IContentUpdate <DeviceBodyEntity> update)
        {
            var updateContent = await update.ContentTask ?? typeof(DeviceBodyEntity).InstantiateUninitializedObject <DeviceBodyEntity>();

            Body = updateContent;
        }
 public static ContentUpdate <DeepContentType> CreateUpdateFromContent <ContentType, DeepContentType>(this IContentUpdate <ContentType> update, Func <ITask <ContentType>, DeepContentType> getDeepContent, object?updateCreationSource)
 => new ContentUpdate <DeepContentType>(getDeepContent(update.ContentTask), update.OriginalUpdateCreationSource, updateCreationSource);
Esempio n. 7
0
 protected override Task UpdateContentByAsync(IContentUpdate <DeviceHeaderViewModel> update)
 => throw new NotImplementedException();
 protected override async Task UpdateContentByAsync(IContentUpdate <DeviceHeaderStateEntity> update)
 {
     State = await update.ContentTask;
 }
Esempio n. 9
0
 protected virtual Task UpdateContentByAsync(IContentUpdate <ContentType> update) =>
 Task.CompletedTask;