/// <summary> /// Creates new connection. /// </summary> /// <param name="address">Server address to connect.</param> /// <param name="token">Bearer scheme token to server access.</param> /// <param name="disconnectListener">Listener will be called when the connection is interrupted.</param> /// <exception cref="DxException">Create connection failed.</exception> public NativeConnection(string address, string token, Action <IDxConnection> disconnectListener) { this.termination_notifier = OnDisconnect; this.disconnectListener = disconnectListener; C.CheckOk(C.Instance.dxf_create_connection_auth_bearer(address, token, termination_notifier, connectionStatusChangeHandler, null, null, IntPtr.Zero, out handler)); }
/// <summary> /// Creates the new connection /// </summary> /// <remarks> /// Don't call this constructor inside any listeners and callbacks of NativeSubscription, NativeConnection, /// NativeRegionalBook, NativeSnapshotSubscription classes /// </remarks> /// <param name="address">The server address to connect</param> /// <param name="disconnectListener">The listener that will be called when the connection is interrupted</param> /// <exception cref="DxException"></exception> public NativeConnection(string address, Action <IDxConnection> disconnectListener) { this.terminationNotifier = OnDisconnect; this.connectionStatusChangeHandler = ConnectionStatusChangeHandler; this.creationNotifier = OnNativeCreate; this.disconnectListener = disconnectListener; C.CheckOk(C.Instance.dxf_create_connection(address, terminationNotifier, connectionStatusChangeHandler, null, null, IntPtr.Zero, out handle)); }
/// <summary> /// Creates new connection. /// </summary> /// <param name="address">Server address to connect.</param> /// <param name="credential">User name and password to server access.</param> /// <param name="disconnectListener">Listener will be called when the connection is interrupted.</param> /// <param name="connectionStatusListener">listener will be called when the connection status is changed</param> /// <exception cref="DxException">Create connection failed.</exception> public NativeConnection(string address, System.Net.NetworkCredential credential, Action <IDxConnection> disconnectListener, Action <IDxConnection, ConnectionStatus, ConnectionStatus> connectionStatusListener) { this.termination_notifier = OnDisconnect; this.disconnectListener = disconnectListener; this.connectionStatusListener = connectionStatusListener; C.CheckOk(C.Instance.dxf_create_connection_auth_basic(address, credential.UserName, credential.Password, termination_notifier, connectionStatusChangeHandler, null, null, IntPtr.Zero, out handler)); }
/// <summary> /// Creates new connection. /// </summary> /// <param name="address">Server address to connect.</param> /// <param name="authscheme">The authorization scheme.</param> /// <param name="authdata">The authorization data.</param> /// <param name="disconnectListener">Listener will be called when the connection is interrupted.</param> /// <param name="connectionStatusListener">listener will be called when the connection status is changed</param> /// <exception cref="DxException">Create connection failed.</exception> public NativeConnection(string address, string authscheme, string authdata, Action <IDxConnection> disconnectListener, Action <IDxConnection, ConnectionStatus, ConnectionStatus> connectionStatusListener) { this.termination_notifier = OnDisconnect; this.disconnectListener = disconnectListener; this.connectionStatusListener = connectionStatusListener; C.CheckOk(C.Instance.dxf_create_connection_auth_custom(address, authscheme, authdata, termination_notifier, connectionStatusChangeHandler, null, null, IntPtr.Zero, out handler)); }