public virtual IDisposable PublishCommand <T>(CommandBase <T> command, IObserver <ICommandResponse <T> > observer = null) { IDisposable subscription = null; if (observer != null) { subscription = command.Subscribe(observer); } AddCommand(command); return(subscription); }
protected virtual void HandleAddedCommand <T>(CommandBase <T> item) { item.SerialNumber = _commandCounter++; item.CurrentState = CommandState.Pending; PushToFilter(item); if (_subscriptions.ContainsKey(item)) { _subscriptions[item].Dispose(); } _subscriptions[item] = item.Subscribe(Observer.Create <ICommandResponse <T> >( _ => { }, ex => { RemoveCommand(item); }, () => { RemoveCommand(item); })); }
protected virtual void HandleAddedCommand(CommandBase item) { item.SerialNumber = _commandCounter++; item.CurrentState = CommandState.Pending; PushToFilter(item); if (_subscriptions.ContainsKey(item)) { _subscriptions[item].Dispose(); } _subscriptions[item] = item.Subscribe(u => { }, ex => RemoveCommand(item), () => RemoveCommand(item)); }