47 lines
1.3 KiB
C#
47 lines
1.3 KiB
C#
using System;
|
|
|
|
namespace BCG
|
|
{
|
|
/// <summary>
|
|
/// A more complete and 'correct' version of BlueRowCollectionStaticStream. Should replace it finally, though
|
|
/// at this time, to expedite the process, both exist simultaniously
|
|
/// </summary>
|
|
public class MutableStream : ViewStream
|
|
{
|
|
public MutableStream () {}
|
|
|
|
public MutableStream (IBlueRowCollection rows)
|
|
{
|
|
loadCollection (rows);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Fires a datapacket with newRows set to the argument, and the whole previous state (if existed)
|
|
/// set as the deletedRows.
|
|
/// </summary>
|
|
/// <param name="rows"></param>
|
|
public void loadCollection (IBlueRowCollection rows)
|
|
{
|
|
myFireEvent(new DataPacket(
|
|
rows,
|
|
new BlueTable(rows),
|
|
myLastValue is DataPacket dp
|
|
? new BlueTable(dp.newRows)
|
|
: new BlueTable(rows.schema)));
|
|
}
|
|
|
|
/// <summary>
|
|
/// Fires the whole datapacket as one. Its the callers responsibility to make sure that it makes incremental sense
|
|
/// </summary>
|
|
/// <param name="dp"></param>
|
|
public void loadPacket (DataPacket dp) {myFireEvent (dp);}
|
|
|
|
protected override void myOnFirstSubscriber()
|
|
{
|
|
if (myLastValue != null)
|
|
loadPacket (myLastValue as DataPacket);
|
|
}
|
|
}
|
|
|
|
}
|