title: How can a self-hosted (WinForm ) WCF service interact with the main form?
body: <p>Simplified version of what I'm trying to achieve:</p>
  
  <ul>
  <li>I have a WinForms app that runs hidden (Visible = false) in the background.</li>
  <li>It's got only one Form, and I kept the default name - Form1</li>
  <li>This WinForms app hosts a WCF Service.  For now we'll call it the Listener service.</li>
  <li>This Listener service has a function called "DisplayAlert()" that's exposed as a service function</li>
  <li>An app sits on another machine sends a message to the Listener Service via a standard WCF service call</li>
  </ul>
  
  <p>I've got all of the above working just fine.  I can step through the code and watch the flow of messages as the DisplayAlert() function is called.  </p>
  
  <p>What I can't figure out, and I can't believe it's so hard to find how to do something this simple: </p>
  
  <p><strong>-  I'd like the DisplayAlert() function in the hosted service interact directly with the WinForm that's hosting it to make the form visible.</strong>  </p>
  
  <p>All I want to do is set the Visibility to true, and call another function on the WinForm.</p>
  
  <p>This seems to me like it should be as simple as adding a reference to the form, or making a public function on the form and calling it from the service class, but I can't even figure out how to reference Form1 from within the service class.</p>
  
  <p>Am I missing something obvious? How do I even reference the instance of Form1, which is hosting the service?</p>
  
  <p>I've gone down the path of....</p>
  
  <ul>
  <li>Creating an event in the ListenerService (AlertReceived, virtual void OnAlertReceived), thinking that on the Form, I could add an event handler.<br>
  <ul>
  <li>No dice.  I'm not instantiating a ListenerService class directly, it's running in the ServiceHost.</li>
  </ul></li>
  <li>Trying to reference the Application object from within the class, thinking I could reference it as Application.Form1, but nope.  I can't even see the Application object from within the service class.
  <ul>
  <li>I'm probably missing something obvious here, but I'm not sure.</li>
  </ul></li>
  </ul>
  
  <p>Any other suggestions?</p>
  
  <p>I can add code if it helps.</p>