title: How to run a method immediately after starting up the program?
body: <p>I am using C# WPF, but I can't figure out how to start a method after I start the .exe file. I have made a console application and I do not want to see any forms/windows.</p>
  
  <p>I got rid of the whole <code>MainWindow()</code> method, and I also added the method I want to call in my <code>Main()</code> method. I deleted the <code>StartupUri="MainWindow.xaml"</code> line from the App.xaml and I expected the software to run the <code>Main()</code> method on start up, but instead it keeps calling the <code>MainWindow()</code> method from my <code>MainWindow.cs</code> class. I know that, because when I put back my <code>MainWindow()</code> method it executed everything inside that method.</p>
  
  <p>The first thing that I tried was putting my method calling in the <code>MainWindow()</code> method, but it keeps looping and I do not want it to. I guess a work around for that would be endless <code>Thread.Sleep()</code>, but that seems like a really stupid thing to do.</p>
  
  <p>Here is what my <code>Main()</code> method looks like:</p>
  
  <pre><code>    /// &lt;summary&gt;
      /// Application Entry Point.
      /// &lt;/summary&gt;
      [System.STAThreadAttribute()]
      [System.Diagnostics.DebuggerNonUserCodeAttribute()]
      [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
      public static void Main() {
            System.Windows.MessageBox.Show("it's working"); //shows this message it this method is called
      }
  </code></pre>
  
  <p>Here is the whole <code>App.xaml</code>:</p>
  
  <pre><code>&lt;Application x:Class="PHAutoProcess.App"
               xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt;
      &lt;Application.Resources&gt;
  
      &lt;/Application.Resources&gt;
  &lt;/Application&gt;
  </code></pre>