title: Resend monitored items value after reconnect with WPF and OP UA
body: <p>I'm writting a control software / HMI using <a href="https://github.com/convertersystems/workstation-uaclient" rel="nofollow">this</a> ua-client for WPF, with Kepwere as OPC Server.</p>
  
  <p>Today I was doing some connection tests, disconnecting the ethernet cable of my PLC and change some monitored item value in the software. Obviously this change wont take effect because the connection state, but, after reconnect why don't refresh the PLC tag with the value that I previously set?</p>
  
  <p>Or this is the expected behavior and I need to make some internal storage variable to replicate this?</p>
  
  <p>Kepserver have a System.NoError Tag that indicate if there is an error on the PLC, so I know when the PLC is offline. But I'm trying to resend the latest change while was offline whe it reconnect.</p>
  
  <p>I overwrote the SetProperty method:</p>
  
  <pre><code>protected override bool SetProperty&lt;T&gt;(ref T storage, T value, [CallerMemberName] string propertyName = null)
  {
  
      if(ServerState != CommunicationState.Opened || (!System_NoError &amp;&amp; "System_NoError" != propertyName))
      {
          m_eventsPending.Add(new WriteEvent
          {
              PropertyName = propertyName,
              PropertyValue = value
          });
          return false;
      }
  
      return base.SetProperty(ref storage, value, propertyName);
  }
  </code></pre>
  
  <p>And then listen to the server state change event with this:</p>
  
  <pre><code>public void OnStateChangeEvent(CommunicationState state)
  {
      ServerState = state;
  }
  </code></pre>
  
  <p>On every change on System_NoError I do:</p>
  
  <pre><code>    private void OnError()
      {
          if(System_NoError)
          {
              while(m_eventsPending.Count &gt; 0)
              {
                  WriteEvent e = m_eventsPending.ElementAt(0);
                  bool storage = !(bool)e.PropertyValue;
                  var p = this.GetType().GetProperty(e.PropertyName);
                  p.SetValue(this, storage);
                  p.SetValue(this, e.PropertyValue);
                  m_eventsPending.RemoveAt(0);
              }
          }
      }
  </code></pre>
  
  <p>I do some initialization and keep it on the m_eventsPending list, and start sending when connection is complete (Opened), but nothing happend on the PLC side. What could be wrong?</p>
  
  <p>P.S: Any other interaction with the software make the correct change on the PLC, acording to my code (buttons, slider, etc)</p>
  
  <p>Best Regards
  Jose Truyol</p>