Exemplo n.º 1
0
    /// <summary>
    /// Notifies the main instance that this instance is attempting to start up.
    /// </summary>
    /// <param name="guid">The application's unique identifier.</param>
    private static void NotifyMainInstance(Guid guid)
    {
        NetNamedPipeBinding binding       = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None);
        EndpointAddress     remoteAddress = new EndpointAddress(CreateAddress(guid));

        using (ChannelFactory <ISingleInstance> factory = new ChannelFactory <ISingleInstance>(binding, remoteAddress))
        {
            ISingleInstance singleInstance = factory.CreateChannel();
            singleInstance.NotifyMainInstance(Environment.GetCommandLineArgs());
        }
    }