Пример #1
0
        public virtual void Dispose()
        {
            InformerModel?.Dispose();
            CatalogModel?.Dispose();
            ExplorerModel?.Dispose();
            EditorModel?.Dispose();

            _modelDisposable.Dispose();
        }
Пример #2
0
        private IDisposable BindInformer()
        {
            Model.InformerModel = InformerModel.Hidden();

            return(SubscribeToTarget(target =>
            {
                _informerActivator.Deactivate(ref _informerController);
                var model = _informerActivator.Activate(target, ref _informerController);
                Model.InformerModel = model;
            }));
        }
Пример #3
0
        private IDisposable BindInformer(IFactory <Target, InformerModel> informerModelFactory)
        {
            var chatSubscription = SubscribeToSelectedChat(chat =>
            {
                InformerModel?.Dispose();
                InformerModel = informerModelFactory.Create(chat);
            });

            var aggregateSubscription = SubscribeToSelectedAggregate(aggregate =>
            {
                InformerModel?.Dispose();
                InformerModel = informerModelFactory.Create(aggregate);
            });

            return(Disposable.Create(() =>
            {
                chatSubscription.Dispose();
                aggregateSubscription.Dispose();
            }));
        }
Пример #4
0
        public static IDisposable BindInformer(this MessengerModel model)
        {
            model.InformerModel = InformerModel.Hidden();

            return(model.SubscribeToSelection(entry =>
            {
                switch (entry)
                {
                case ChatEntryModel chatEntryModel:
                    model.InformerModel = new InformerModel(chatEntryModel.Chat);
                    break;

                case AggregateEntryModel aggregateEntryModel:
                    model.InformerModel = new InformerModel(aggregateEntryModel.Aggregate);
                    break;

                case HomeEntryModel _:
                    model.InformerModel = InformerModel.Hidden();
                    break;
                }
            }));
        }