title: Creating Delegate Events
body: <p>I'm trying to create a delegate event that is accessible in another form. But the main form doesn't seen to be able to see my delegate. It say delegate name is not valid at this point.
  modal form</p>
  
  <pre><code>public partial class GameOverDialog : Window
  {
     public delegate void ExitChosenEvent();
     public delegate void RestartChosenEvent();
  
     public GameOverDialog()
     {
        InitializeComponent();
     }
  
     private void closeAppButton_Click(object sender, RoutedEventArgs e)
     {
        ExitChosenEvent exitChosen = Close;
        exitChosen();
        Close();
     }
  
     private void newGameButton_Click(object sender, RoutedEventArgs e)
     {
        RestartChosenEvent restart = Close;
        restart();
        Close();
     }
  }
  </code></pre>
  
  <p>Main form:</p>
  
  <pre><code>private void ShowGameOver(string text)
  {
     var dialog = new GameOverDialog { tb1 = { Text = text } };
     dialog.RestartChosenEvent += StartNewGame();
     dialog.Show();
  }
  
  private void StartNewGame()
  {
     InitializeComponent();
     InitializeGame();
  }
  </code></pre>
  
  <p><em><strong>After @Fuex's Help</em>*</strong></p>
  
  <pre><code>private void ShowGameOver(string text)
  {
     var dialog = new GameOverDialog { tb1 = { Text = text } };
     dialog.RestartEvent += StartNewGame;
     dialog.ExitEvent += Close;
     dialog.Show();
  }
  </code></pre>