示例#1
0
        public FollowingGetProperty(IObservable <T> predecessor, T defaultValue)
        {
            if (predecessor == null)
            {
                throw new ArgumentNullException("predecessor");
            }

            predecessor.Subscribe(Observer2.Create <T>(SetValue));
            _value = defaultValue;
        }
        public static IDisposable Subscribe <TSource, TProperty>(this IObservable <TSource> source, IObservableGetProperty <TProperty> property)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }
            if (property == null)
            {
                throw new ArgumentNullException("property");
            }

            return(source.Subscribe(Observer2.Create <TSource>(o => property.OnNext())));
        }
        public void RecognizeAsync()
        {
            // UI スレッドでなければ動作しない?
            var recognizer = new InkTextRecognizer
            {
                Culture = InkTextRecognizer.Culture_ja_JP,
            };

            recognizer.BestResultArrived.Subscribe(Observer2.Create <string>(Console.WriteLine));

            recognizer.AddStroke(new[] { new Point(100, 100), new Point(100, 200) });
            recognizer.RecognizeAsync();

            Thread.Sleep(1000);
        }