Ejemplo n.º 1
0
        public void On(Publish x)
        {
            var notifications = x.Events
                                .Select(e => new Notification(e, DateTime.Now, HubGateway.LocalHubId()))
                                .ToArray();

            observers.Notify(notifications);
        }
Ejemplo n.º 2
0
        protected override void Define()
        {
            On((InitHub x) => {});

            On((Subscribe x) => observers.Add(x.Observer));

            On((PublishEvents x) =>
            {
                var notifications = x.Events
                                    .Select(e => new Notification(e, DateTime.Now, HubGateway.LocalHubId()))
                                    .ToArray();

                observers.Notify(notifications);
            });
        }
Ejemplo n.º 3
0
 void NotifyAvailable()
 {
     observers.Notify(new AvailabilityChanged(Id, true));
 }
Ejemplo n.º 4
0
 void Notify() => observers.Notify(new AvailabilityChanged(Self, available));
Ejemplo n.º 5
0
 /// <summary>
 /// Notifies all attached observers about given notifications.
 /// </summary>
 /// <param name="notifications">The notification messages</param>
 protected void Notify(params Notification[] notifications)
 {
     observers.Notify(Identity.Of(this), notifications);
 }
Ejemplo n.º 6
0
 public Task Handle(SetText cmd)
 {
     text = cmd.Text;
     observers.Notify(new TextChanged(cmd.Text));
     return(TaskDone.Done);
 }