public UserEventProcessor()
        {
            eventObservable = DbObservable <BiContext>
                              .FromInserting <EventEntity>()
                              .Where(e => e.Entity.Body is UserEvent);

            eventObservable.Where(e => e.Entity.Body is UserCreatedEvt)
            .Subscribe(onCreate);
            eventObservable.Where(e => e.Entity.Body is UserUpdatedEvt)
            .Subscribe(onUpdate);
            eventObservable.Where(e => e.Entity.Body is PasswordChangedEvt)
            .Subscribe(onPasswordChange);
        }
Beispiel #2
0
 private void Init(string address, int port, System.Net.Sockets.TcpClient connection)
 {
     this.IsDisposed = false;
     this.Address    = address;
     this.Port       = port;
     this.Stream     = connection.GetStream();
     this.Stream.WriteByte(0xFF);
     this.Stream.WriteByte(0xFB);
     this.Stream.WriteByte(0x01);
     this.Stream.ReadAsync(this.InputBuffer, 0, this.InputBuffer.Length);
     this.Stream.WriteByte((byte)'>');
     this.InputObservable = System.Reactive.Linq.Observable.ToObservable <byte>(this.Read());
     Session.Connections.Add(this);
     App.Log($"+++ {this.Address} ({this.Port})");
     this.InputObservableSubscription = this.InputObservable.Subscribe(this.Read);
 }
    public LeapHandDataVisualizer(
        [Inject(Id = "Fingertip prefab")]           GameObject fingerTipPrefab,
        [Inject(Id = "Fingertip parent")]           Transform fingertipParent,
        [Inject(Id = "Transformed frame stream")]   UniRx.Subject <LeapFrameData> transformedFrameStream)
    {
        for (int i = 0; i < 2; ++i)
        {
            for (int j = 0; j < 5; ++j)
            {
                _fingertips[i, j] = UnityEngine.Object.Instantiate(fingerTipPrefab);
                _fingertips[i, j].transform.SetParent(fingertipParent);
                _fingertips[i, j].SetActive(false);
            }
        }

        _mainThreadFrameStream = transformedFrameStream.ObserveOn(Scheduler.MainThread).SubscribeOn(Scheduler.MainThread) as System.IObservable <LeapFrameData>;
        _frameStreamObserver   = new FrameStreamObserver(this);
    }
Beispiel #4
0
            private void Dispose(bool disposing)
            {
                if (false == this.IsDisposed)
                {
                    this.IsDisposed = true;

                    if (disposing)
                    {
                        try
                        {
                            App.Log($"--- {this.Address} ({this.Port})");
                            this.Address         = null;
                            this.Port            = -1;
                            this.InputObservable = null;
                            this.Stream?.Dispose();
                        }
                        finally
                        {
                            this.Stream          = null;
                            this.InputObservable = null;

                            for (var i = 0; i < this.InputBufferIndex; i++)
                            {
                                this.InputBuffer[i] = 0;
                            }

                            this.InputBufferIndex   = 0;
                            this.InputByte          = default(byte);
                            this.InputChar          = default(char);
                            this.InputStringBuilder = this.InputStringBuilder.Clear();
                            Session.Connections.Remove(this);
                            Session.Pool.Push(this);
                        }
                    }
                }
            }
 public SingleRecordDatabaseCellViewModel(int columnIndex, string columnName, ICommand action, DatabaseEntityViewModel parent, DatabaseEntity entity, System.IObservable <string> label) : base(entity)
 {
     Parent               = parent;
     ColumnIndex          = columnIndex * 2;
     CanBeNull            = false;
     IsReadOnly           = false;
     ColumnName           = columnName;
     OriginalValueTooltip = null;
     ActionCommand        = action;
     AutoDispose(label.SubscribeAction(s =>
     {
         ActionLabel = s;
         RaisePropertyChanged(nameof(ActionLabel));
     }));
 }
 public static IObservable <Unit> ZipToUnit <T>(this System.IObservable <T> first, System.IObservable <T> second)
 {
     return(Observable.Zip(first, second, (x, y) => new Unit()));
 }