public void On(Publish x) { var notifications = x.Events .Select(e => new Notification(e, DateTime.Now, HubGateway.LocalHubId())) .ToArray(); observers.Notify(notifications); }
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); }); }
void NotifyAvailable() { observers.Notify(new AvailabilityChanged(Id, true)); }
void Notify() => observers.Notify(new AvailabilityChanged(Self, available));
/// <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); }
public Task Handle(SetText cmd) { text = cmd.Text; observers.Notify(new TextChanged(cmd.Text)); return(TaskDone.Done); }