title: Message Box in IronPython with WPF
body: <p>I'm trying to create a simple GUI using WPF in VS2017. I've tried following code to show a MessageBox after clicking generate button:</p>
  
  <pre><code>import wpf
  from System.Windows import MessageBox
  def generate_Btn_Click(self, sender, e):
     MessageBox.Show("hi")
  </code></pre>
  
  <p>and it will show up if I click on the generate button but, if I try to add an if statement before <code>MessageBox.Show()</code>:</p>
  
  <pre><code>def generate_Btn_Click(self, sender, e):
      if A == None: 
          MessageBox.Show("Message1!")
      else:
          MessageBox.Show("Message2!")
  </code></pre>
  
  <p>after clicking on generate button, no MessageBox appears and the window closes. My question is how to use MessageBox In IronPython using WPF.
  A simple example that will not work when I push the button is as follows:</p>
  
  <pre><code>import wpf
  from System.Windows import MessageBox
  from System.Windows import Application, Window
  
  class MyWindow(Window):
      def __init__(self):
          wpf.LoadComponent(self, 'IronPython5.xaml')
      str1 = ""
      def Button_Click(self, sender, e):
          if str1 == "":
              MessageBox.Show("msg1")
          else:
              MessageBox.Show("msg2")
  
          pass
  
  
  if __name__ == '__main__':
      Application().Run(MyWindow())
  </code></pre>
  
  <p>This is the XAML:</p>
  
  <pre><code>&lt;Window 
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
         Title="IronPython5" Height="300" Width="300"&gt; 
         &lt;Grid&gt;
          &lt;Button Content="Button" HorizontalAlignment="Left" Margin="159,238,0,0" VerticalAlignment="Top" Width="75" Click="Button_Click"/&gt;
      &lt;/Grid&gt;
  &lt;/Window&gt; 
  </code></pre>