public virtual void SetSelectedObservable(TId observableId)
 {
     try
     {
         if (Observables.Any())
         {
             var usedObservable = Observables.FirstOrDefault(x => x.Id.Equals(observableId));
             if (usedObservable != null)
             {
                 ObservableSelectedMapper.UpdateDestination(usedObservable, SelectedObservable);
             }
             else
             {
                 var result = Resolver.Resolve <IListBusiness <TId, TDomain> >().GetByIdAsync(observableId).Result; // Todo make method async?
                 if (result != null)
                 {
                     DomainSelectedMapper.UpdateDestination(result, SelectedObservable);
                 }
             }
         }
     }
     catch (Exception)
     {
         // todo logging
     }
 }
        protected virtual void ItemUpdatedHandler(MessageBase <TDomain> messageBase)
        {
            // Update item in the list
            var itemInList = Observables.FirstOrDefault(x => x.Id.Equals(messageBase.Object.Id));

            if (itemInList != null)
            {
                DomainObservableMapper.UpdateDestination(messageBase.Object, itemInList);
            }

            // Update the selected item only if updated and is selected
            if (SelectedObservable.Id.Equals(messageBase.Object.Id) && messageBase.State == EDomainState.Updated)
            {
                DomainSelectedMapper.UpdateDestination(messageBase.Object, SelectedObservable);
            }
        }
Exemple #3
0
 /// <summary>
 /// Handler that manages single object updates.
 ///
 /// This will update an object as the selected observable.
 /// </summary>
 /// <param name="messageBase"></param>
 protected virtual void ItemUpdatedHandler(MessageBase <TDomain> messageBase)
 {
     DomainSelectedMapper.UpdateDestination(messageBase.Object, SelectedObservable);
 }