/// <summary>
/// Creates a new session.
/// </summary>
private Session CreateSession()
{
try
{
Cursor = Cursors.WaitCursor;
ServiceMessageContext messageContext = m_configuration.CreateMessageContext();
BindingFactory bindingFactory = BindingFactory.Create(m_configuration, messageContext);
ConfiguredEndpoint endpoint = this.EndpointsCTRL.SelectedEndpoint;
endpoint.UpdateFromServer(bindingFactory);
// Initialize the channel which will be created with the server.
ITransportChannel channel = SessionChannel.Create(
m_configuration,
endpoint.Description,
endpoint.Configuration,
m_configuration.SecurityConfiguration.ApplicationCertificate.Find(true),
messageContext);
// Wrap the channel with the session object.
Session session = new Session(channel, m_configuration, endpoint, null);
// Create the session. This actually connects to the server.
session.Open(Guid.NewGuid().ToString(), null);
return session;
}
finally
{
Cursor = Cursors.Default;
}
}