diff --git a/Examples/TestRegisters.cs b/Examples/TestRegisters.cs
index 101b80d..9295e7b 100644
--- a/Examples/TestRegisters.cs
+++ b/Examples/TestRegisters.cs
@@ -45,8 +45,7 @@ namespace Examples {
//corresponds to a DT7012 - DT7013 as a 32bit time value that gets parsed as a timespan (TIME)
//the smallest value to communicate to the PLC is 10ms
[Register(7012)]
- public TimeSpan TestTime { get; private set; }
-
+ public TimeSpan TestTime { get; private set; }
}
}
diff --git a/MewtocolNet/Mewtocol/MewtocolInterface.cs b/MewtocolNet/Mewtocol/MewtocolInterface.cs
index cf330ad..0f63063 100644
--- a/MewtocolNet/Mewtocol/MewtocolInterface.cs
+++ b/MewtocolNet/Mewtocol/MewtocolInterface.cs
@@ -356,6 +356,14 @@ namespace MewtocolNet {
};
+ if (collection != null)
+ collection.OnInterfaceLinked(this);
+
+ Connected += (i) => {
+ if(collection != null)
+ collection.OnInterfaceLinkedAndOnline(this);
+ };
+
return this;
}
diff --git a/MewtocolNet/Mewtocol/RegisterAttributes/RegisterCollectionBase.cs b/MewtocolNet/Mewtocol/RegisterAttributes/RegisterCollectionBase.cs
index f86c61b..42ad25d 100644
--- a/MewtocolNet/Mewtocol/RegisterAttributes/RegisterCollectionBase.cs
+++ b/MewtocolNet/Mewtocol/RegisterAttributes/RegisterCollectionBase.cs
@@ -10,17 +10,34 @@ using System.Threading.Tasks;
namespace MewtocolNet.RegisterAttributes {
+ ///
+ /// A register collection base with full auto read and notification support built in
+ ///
public class RegisterCollectionBase : INotifyPropertyChanged {
+ ///
+ /// Reference to its bound interface
+ ///
public MewtocolInterface PLCInterface { get; set; }
+ ///
+ /// Whenever one of its props changes
+ ///
public event PropertyChangedEventHandler PropertyChanged;
- internal void TriggerPropertyChanged (string propertyName = null) {
+ ///
+ /// Triggers a property changed event
+ ///
+ /// Name of the property to trigger for
+ public void TriggerPropertyChanged (string propertyName = null) {
var handler = PropertyChanged;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
+ public virtual void OnInterfaceLinked (MewtocolInterface plc) { }
+
+ public virtual void OnInterfaceLinkedAndOnline (MewtocolInterface plc) { }
+
}
}