diff --git a/AutoTx/AutoTx.cs b/AutoTx/AutoTx.cs index eacf7e09ba89e8d585fabe8dccee57859833b5b4..1ce230324ed04c9145c3a26b719d16f413ef78ea 100644 --- a/AutoTx/AutoTx.cs +++ b/AutoTx/AutoTx.cs @@ -419,8 +419,8 @@ namespace AutoTx // all parameters within valid ranges, so set the state to "Running": if (string.IsNullOrEmpty(limitReason)) { _serviceSuspended = false; - if (!string.IsNullOrEmpty(_lastLimitReason)) { - _lastLimitReason = ""; // reset to force a message on next service suspend + if (!string.IsNullOrEmpty(_status.LimitReason)) { + _status.LimitReason = ""; // reset to force a message on next service suspend writeLog("Service resuming operation (all parameters in valid ranges)."); } return; @@ -429,8 +429,8 @@ namespace AutoTx // set state to "Running" if no-one is logged on: if (NoUserIsLoggedOn()) { _serviceSuspended = false; - if (!string.IsNullOrEmpty(_lastLimitReason)) { - _lastLimitReason = ""; // reset to force a message on next service suspend + if (!string.IsNullOrEmpty(_status.LimitReason)) { + _status.LimitReason = ""; // reset to force a message on next service suspend writeLog("Service resuming operation (no user logged on)."); } return; @@ -438,10 +438,10 @@ namespace AutoTx // by reaching this point we know the service should be suspended: _serviceSuspended = true; - if (limitReason == _lastLimitReason) + if (limitReason == _status.LimitReason) return; writeLog("Service suspended due to limitiations [" + limitReason + "]."); - _lastLimitReason = limitReason; + _status.LimitReason = limitReason; } /// <summary> diff --git a/AutoTx/SystemChecks.cs b/AutoTx/SystemChecks.cs index 4e7cad20b42b97c5c7fcfec928f02a50224e0b17..0dca881d14f06c3bf1c7342a9f01e6856db1df18 100644 --- a/AutoTx/SystemChecks.cs +++ b/AutoTx/SystemChecks.cs @@ -9,7 +9,6 @@ namespace AutoTx { #region global variables - private string _lastLimitReason; // TODO: this should be part of _status! private bool _serviceSuspended; // TODO: this should be part of _status! #endregion diff --git a/AutoTx/XmlConfiguration.cs b/AutoTx/XmlConfiguration.cs index 90d0de47c3ca953dbd4b005cdb7c612faed08f18..c327c730be76ef6e2302b60394d25670c0583ad9 100644 --- a/AutoTx/XmlConfiguration.cs +++ b/AutoTx/XmlConfiguration.cs @@ -122,6 +122,7 @@ namespace AutoTx private DateTime _lastStorageNotification; private DateTime _lastAdminNotification; + private string _limitReason; string _currentTransferSrc; string _currentTargetTmp; @@ -154,6 +155,15 @@ namespace AutoTx } } + public string LimitReason { + get { return _limitReason; } + set { + _limitReason = value; + log("LimitReason was updated (" + value + "), calling Serialize()..."); + Serialize(); + } + } + public string CurrentTransferSrc { get { return _currentTransferSrc; } set {