31 lines
1009 B
C#
31 lines
1009 B
C#
namespace BCG {
|
|
// this for testing purposes mainly, its wraps a ViewPublisher around a stream,
|
|
// and hence epublishes it out to the PS
|
|
public class PublisherStream : ViewStream {
|
|
private readonly ViewStream _main_stream;
|
|
private readonly string _name;
|
|
private ViewPublisher _vs_publisher;
|
|
private readonly PubTableBroker _broker = new PubTableBroker();
|
|
|
|
public PublisherStream(ViewStream main_stream, string name) {
|
|
_main_stream = main_stream;
|
|
_name = name;
|
|
}
|
|
|
|
protected override void myOnFirstSubscriber() {
|
|
_vs_publisher = new ViewPublisher(_name, _broker, _main_stream);
|
|
_main_stream.onChange += new DataStream.ChangeDelegate(_handle_update);
|
|
}
|
|
|
|
protected override void myOnLastSubscriber() {
|
|
_main_stream.onChange -= new DataStream.ChangeDelegate(_handle_update);
|
|
_vs_publisher.Dispose();
|
|
}
|
|
|
|
private void _handle_update(object o) {
|
|
myFireEvent(o);
|
|
}
|
|
|
|
|
|
}
|
|
} |