title: How to run code right when a C# application starts?
body: <p>I have put some code inside of the public MainWindow() {} but I kept getting some obscure XAML parsing errors as soon as I did that (not on my computer but on 3 others I've tried it on - yep!)</p>
  
  <p>Is there the preferred way to run code AS SOON as t he application starts?</p>
  
  <p>The theory is I want it to call home and ask it it's ok to start. If it's not, I want the app to close out. Call it a makeshift copy-protection :)</p>