예제 #1
0
        /// <summary>
        /// Monitor ISubject stream
        /// </summary>
        /// <typeparam name="TIn">The type of the in.</typeparam>
        /// <typeparam name="TOut">The type of the out.</typeparam>
        /// <param name="instance">The instance.</param>
        /// <param name="name">The name.</param>
        /// <param name="orderingIndex">Index of the ordering.</param>
        /// <param name="surrogate">The surrogate.</param>
        /// <param name="setting"></param>
        /// <returns></returns>
        public static ISubject <TIn, TOut> Monitor <TIn, TOut>(
            this ISubject <TIn, TOut> instance,
            string name,
            double?orderingIndex,
            Func <TOut, object> surrogate,
            VisualRxPublishersSettings setting = null)
        {
            double order   = orderingIndex ?? Interlocked.Increment(ref _order);
            var    monitor = new StreamChannel <TOut>(
                setting, name, order, surrogate);

            var watcher = monitor.AttachTo(instance);

            return(watcher);
        }
예제 #2
0
        /// <summary>
        /// Monitor IObservable stream
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="instance">The instance.</param>
        /// <param name="name">The name.</param>
        /// <param name="orderingIndex">Index of the ordering.</param>
        /// <param name="surrogate">a surrogate.</param>
        /// <param name="setting"></param>
        /// <returns></returns>
        public static IObservable <T> Monitor <T>(
            this IObservable <T> instance,
            string name,
            double?orderingIndex,
            Func <T, object> surrogate,
            VisualRxPublishersSettings setting = null)
        {
            setting = setting ?? VisualRxPublishersSettings.Default;
            double order   = orderingIndex ?? Interlocked.Increment(ref _order);
            var    monitor = new StreamChannel <T>(
                setting, name, order, surrogate);

            var watcher = monitor.AttachTo(instance);

            return(watcher);
        }