Esempio n. 1
0
        public IObservable AddObservable(ObservableIdentifier id)
        {
            Observable observable = new Observable(id, this);

            this.observables.Add(id, observable);
            return(observable);
        }
Esempio n. 2
0
        public Observer(EntityConnection connection, ObservableIdentifier target)
        {
            Observer observer = this;

            if (connection.State == EntityConnection.ConnectionState.Closed || connection.State == EntityConnection.ConnectionState.Bound)
            {
                Log <Observer> .Logger.ErrorFormat("Try to add observer to {1} connection : [{0}]", target, connection.State);

                return;
            }
            this.Conn    = connection;
            this.IsDirty = true;
            this.Conn.RegisterMessageHandler(typeof(AddOk), new Action <EntityConnection, object>(this.AddOkHandler));
            this.Conn.RegisterMessageHandler(typeof(AddFail), new Action <EntityConnection, object>(this.AddFailHandler));
            this.Conn.Closed += new EventHandler <EventArgs <IEntityProxy> >(this.Connection_Closed);
            if (this.Conn.State == EntityConnection.ConnectionState.Connected)
            {
                this.Conn.SendMessage(new AddObserver(target));
            }
            else
            {
                this.Conn.ConnectionSucceeded += delegate(object sender, EventArgs <IEntityProxy> e)
                {
                    observer.Conn.SendMessage(new AddObserver(target));
                };
            }
            this.Target = target;
        }
Esempio n. 3
0
        public override bool Equals(object obj)
        {
            if (base.GetType() != obj.GetType())
            {
                return(false);
            }
            ObservableIdentifier observableIdentifier = (ObservableIdentifier)obj;

            return(this.ID == observableIdentifier.ID && this.Category == observableIdentifier.Category);
        }
Esempio n. 4
0
 public Observable(ObservableIdentifier id, ObservableCollection collection)
 {
     this.ID         = id;
     this.Collection = collection;
 }
Esempio n. 5
0
 public AddObserver(ObservableIdentifier id)
 {
     this.ID = id;
 }
Esempio n. 6
0
 public AddFail(ObservableIdentifier id)
 {
     this.ID = id;
 }
Esempio n. 7
0
 public AddOk(ObservableIdentifier oid, int pid)
 {
     this.ObservableID = oid;
     this.ProxyID      = pid;
 }
Esempio n. 8
0
 public bool RemoveObservable(ObservableIdentifier id)
 {
     return(this.observables.Remove(id));
 }