Add generic ViewStream, BlueRow types/interfaces

This commit is contained in:
John Colvin committed 2025-11-19 12:24:37 -05:00
1 parent 1d70eecb44
commit f571b4992f
39 files changed
+138 -116

No files matched your search

@@ -48,16 +48,17 @@ namespace BCG
}
}
public delegate void ChangeDelegate(object newValue);
public event ChangeDelegate onChange
public event Action<Exception> ErrorChanged;
public event DataStreamChangeDelegate onChange
{
add
{
ChangeDelegate currValue = value;
DataStreamChangeDelegate currValue = value;
if (myTestMode)
{
ChangeDelegateWrapper w = new ChangeDelegateWrapper (value);
currValue = new ChangeDelegate (w.wrapperFunction);
currValue = new DataStreamChangeDelegate (w.wrapperFunction);
myDelMap.Add (value, currValue);
}
if (myRealSource != null)
@@ -65,7 +66,7 @@ namespace BCG
else
{
myOnChangeDelegate =
(ChangeDelegate) Delegate.Combine (myOnChangeDelegate,currValue);
(DataStreamChangeDelegate) Delegate.Combine (myOnChangeDelegate,currValue);
if (myOnChangeDelegate.GetInvocationList().Length == 1) // first subscriber
@@ -90,11 +91,11 @@ namespace BCG
}
remove
{
ChangeDelegate currValue = value;
var currValue = value;
// BlueTrace.WriteViewStreamUnsubscribe(this.ID);
if (myTestMode)
{
currValue = myDelMap[value] as ChangeDelegate;
currValue = myDelMap[value] as DataStreamChangeDelegate;
myDelMap.Remove (value);
}
if (myRealSource != null)
@@ -102,7 +103,7 @@ namespace BCG
else
{
myOnChangeDelegate =
(ChangeDelegate) Delegate.Remove (myOnChangeDelegate,currValue);
(DataStreamChangeDelegate) Delegate.Remove (myOnChangeDelegate,currValue);
// this is need to avoid a callback in a reentrant add.
if (myPendingAdds.Count > 0)
@@ -158,7 +159,7 @@ namespace BCG
// this was made internal for testing purposes only.
// don't mess with it.
internal ChangeDelegate myOnChangeDelegate;
internal DataStreamChangeDelegate myOnChangeDelegate;
protected object myLastValue;
protected DataStream myRealSource;
private Stack myPendingAdds;
@@ -167,9 +168,9 @@ namespace BCG
internal class ChangeDelegateWrapper
{
readonly Stopwatch timer = new();
private DataStream.ChangeDelegate myDel;
private DataStreamChangeDelegate myDel;
internal ChangeDelegateWrapper (DataStream.ChangeDelegate del) {myDel = del;}
internal ChangeDelegateWrapper (DataStreamChangeDelegate del) {myDel = del;}
internal void wrapperFunction (object o)
{