diff --git a/src/Aeon.Acquisition/StateRecoverySubject.cs b/src/Aeon.Acquisition/StateRecoverySubject.cs index 14c339a..37ca173 100644 --- a/src/Aeon.Acquisition/StateRecoverySubject.cs +++ b/src/Aeon.Acquisition/StateRecoverySubject.cs @@ -2,6 +2,7 @@ using System; using System.ComponentModel; using System.Linq.Expressions; +using System.Reactive.Linq; using System.Reactive.Subjects; namespace Aeon.Acquisition @@ -39,11 +40,9 @@ public RecoverySubject(string name) { var state = StateRecovery.Deserialize(name); subject = new BehaviorSubject(state); - Name = name; + subject.Skip(1).Subscribe(value => StateRecovery.Serialize(name, value)); } - string Name { get; } - public void OnCompleted() { } @@ -64,7 +63,6 @@ public IDisposable Subscribe(IObserver observer) public void Dispose() { - StateRecovery.Serialize(Name, subject.Value); subject.Dispose(); } }