Ejemplo n.º 1
0
        public IDisposable Sync(ISynchronizationContext <T> sourceContext,
                                ISynchronizationContext <T> targetContext,
                                SyncMode syncMode = SyncMode.TwoWay)
        {
            switch (syncMode)
            {
            case SyncMode.OneWay:
                return(sourceContext.Subscribe(targetContext));

            case SyncMode.OneWayToSource:
                return(targetContext.Subscribe(sourceContext));

            default:
                return(new CompositeDisposable
                {
                    targetContext.Subscribe(sourceContext),
                    sourceContext.Subscribe(targetContext)
                });
            }
        }