Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Visual Studio 2010 creates Program.cs file for C# application projects.</p> <pre><code>static class Program { /// &lt;summary&gt; /// The main entry point for the application. /// &lt;/summary&gt; [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new frmMain()); } } </code></pre> <p>Application.Run() would, if this was VB.NET, fire "Startup" event. In this case, you don't need to catch that event because you control when is the application going to run using the code specified above.</p> <p>If you want to subscribe to the event fired when the application is about to close, use this code:</p> <pre><code>Application.ApplicationExit += new EventHandler(Application_ApplicationExit); </code></pre> <p>and then define the function to handle this event:</p> <pre><code>static void Application_ApplicationExit(object sender, EventArgs e) { // your shutdown code here ... } </code></pre> <p>As a result, your code should look something like this:</p> <pre><code>using GM.Powertrain.RemoteCopy.Interfaces; using System.Runtime.Remoting.Channels.Tcp; using System.Runtime.Remoting.Channels; namespace ProjectName { static class Program { private static ServiceConfig serviceConfig = serviceConfig.Load(); /// &lt;summary&gt; /// The main entry point for the application. /// &lt;/summary&gt; [STAThread] static void Main() { TcpChannel channel = new TcpChannel(); ChannelServices.RegisterChannel(channel, false); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new frmMainCard()); Application.ApplicationExit += new EventHandler(Application_ApplicationExit); } public static ServiceConfig Conifg { get { return serviceConfig; } } public static IRemoteCopier LocalMachine { get { return serviceConfig.GetObject&lt;IRemoteCopier&gt;("localhost"); } } static void Application_ApplicationExit(object sender, EventArgs e) { throw new NotImplementedException(); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload