Exemplo n.º 1
0
 /// <summary>
 /// Notifies the main instance that this instance is attempting to start up.
 /// </summary>
 /// <param name="uid">The application's unique identifier.</param>
 public static void NotifyFirstInstance(string uid)
 {
     //create channel with first instance interface
     using (ChannelFactory <ISingleInstance> factory = new ChannelFactory <ISingleInstance>(
                new NetNamedPipeBinding(), new EndpointAddress("net.pipe://localhost/7thHeavenApp/" + uid)))
     {
         ISingleInstance singleInstanceInterface = factory.CreateChannel();
         //pass the command-line args to the first interface
         singleInstanceInterface.PassStartupArgs(Environment.GetCommandLineArgs());
     }
 }