title: Show WPF window from another application in C#
body: <p>I have an WPF application called app1 which has a windows named window1. When the user clicks the close button of <code>window1</code>, the app does not close but the window1 hides (<code>this.hide()</code>).</p>
  
  <p>I want to check if another instance of the application is already running when it is started; if so, I want to show the already running instance and terminate the new one.</p>
  
  <p>How can I do that?</p>
  
  <p>I know how to check the process and how to close the current app but I don't know how to show a window from another WPF process which is running...</p>
  
  <p>In my App startup event I do this :
  </p>
  
  <pre><code>private void Application_Startup(object sender, StartupEventArgs e)
  {
      if(Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName).Count() &gt; 1)
      {
          Application.Current.Shutdown(0);
      }
  }  
  </code></pre>