The Reflection Terminal User Control (TUC) can be embedded in your Windows applications to provide a terminal screen on a Windows form along with another application or a different data source. This control renders a terminal emulator session within a given windows form application.
You can also embed Reflection Terminal User Controls on Windows Presentation Foundation (WPF) applications.
Note: The required assemblies are automatically added to the project references after you add the control to the form.
Initialize an IBM 3270 terminal |
Copy Code
|
---|---|
private void Form1_Load(object sender, EventArgs e) { ibmTerminalControl1.InitInstance(Attachmate.Reflection.UserControl.IbmHosts.HostType.IBM3270); } |
Set the host address and connect to the host |
Copy Code
|
---|---|
private void ibmTerminalControl1_TerminalInitializedEvent(object sender, AsyncCompletedEventArgs e) { // Check if error occurred during the terminal initialization if (e.Error != null) { MessageBox.Show("Error during terminal initialization step: " + e.Error); return; } ibmTerminalControl1.IbmTerminal.HostAddress = "yourHostName"; ibmTerminalControl1.IbmTerminal.Port = 23; ibmTerminalControl1.IbmTerminal.Connect(); } |
Close the terminal |
Copy Code
|
---|---|
private void Form1_FormClosing(Object sender, FormClosingEventArgs e) { ibmTerminalControl1.IbmTerminal.Close(Attachmate.Reflection.CloseOption.CloseNoSave); ibmTerminalControl1 = null; } |
Note:
You may see the following compiler warning:
Warning A reference was created to embedded interop assembly 'c:\Windows\assembly\
GAC_MSIL\Reflection\<version>__13bff1b6907eadcf\Reflection.dll' because of an indirect reference to that assembly created by assembly 'c:\Program Files\Micro Focus\Reflection\Programmer Interfaces\Attachmate.Reflection.UserControl.IbmHosts.dll'. Consider changing the 'Embed Interop Types' property on either assembly.
The simplest way to resolve this warning is to set the Embed Interop Types property of the ReflectionReference to False. For more about how to resolve this warning, see Technical Note 2579.
Note: The required assemblies are automatically added to the project references after you add the control to the form.
Initialize an IBM 3270 terminal |
Copy Code
|
---|---|
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load IbmTerminalControl1.InitInstance(Attachmate.Reflection.UserControl.IbmHosts.HostType.IBM3270) End Sub |
Set the control to fill the form |
Copy Code
|
---|---|
Private Sub IbmTerminalControl1_Load(sender As Object, e As EventArgs) Handles IbmTerminalControl1.Load IbmTerminalControl1.Dock = DockStyle.Fill End Sub |
Set the host address and connect to the host |
Copy Code
|
---|---|
Private Sub IbmTerminalControl1_TerminalInitializedEvent(sender As Object, e As System.ComponentModel.AsyncCompletedEventArgs) Handles IbmTerminalControl1.TerminalInitializedEvent REM Check if error occurred during the terminal initialization Dim ts As String ts = Nothing If (e.Error IsNot ts) Then MessageBox.Show("Error during terminal initialization step: " & e.Error.ToString) Return End If IbmTerminalControl1.IbmTerminal.HostAddress = "yourHostName" IbmTerminalControl1.IbmTerminal.Port = 23 IbmTerminalControl1.IbmTerminal.Connect() End Sub |
Close the terminal |
Copy Code
|
---|---|
Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing IbmTerminalControl1.IbmTerminal.Close(Attachmate.Reflection.CloseOption.CloseNoSave) IbmTerminalControl1 = Nothing End Sub |
Note:
You may see the following compiler warning:
Warning A reference was created to embedded interop assembly 'c:\Windows\assembly\
GAC_MSIL\Reflection\<version>__13bff1b6907eadcf\Reflection.dll' because of an indirect reference to that assembly created by assembly 'c:\Program Files\Attachmate\Reflection\Programmer Interfaces\Attachmate.Reflection.UserControl.IbmHosts.dll'. Consider changing the 'Embed Interop Types' property on either assembly.
The simplest way to resolve this warning is to set the Embed Interop Types property of the ReflectionReference to False. For more about how to resolve this warning, see Technical Note 2579.
Note: The required assemblies are automatically added to the project references after you add the control to the form.
Create an Open Systems terminal |
Copy Code
|
---|---|
private void Form1_Load(object sender, EventArgs e) { openSystemsTerminalControl1.InitInstance(); } |
using Attachmate.Reflection.Emulation.OpenSystems;
Set the host address and connect to the host |
Copy Code
|
---|---|
private void openSystemsTerminalControl1_TerminalInitializedEvent(object sender, AsyncCompletedEventArgs e) { // Check if error occurred during the terminal initialization if (e.Error != null) { MessageBox.Show("Error during terminal initialization step: " + e.Error); return; } ITerminal Terminal = openSystemsTerminalControl1.Terminal; //Use this code for a telnet connection Terminal.ConnectionType = ConnectionTypeOption.Telnet; ((IConnectionSettingsTelnet)Terminal.ConnectionSettings).HostAddress = "yourHost.com"; // replace this hard-coded host name with your host name ((IConnectingSettingsBestNetwork)Terminal.ConnectionSettings).TelnetPort = 23; /* Use this code for a secure connection, instead of the previous code for telnet Terminal.ConnectionType = ConnectionTypeOption.SecureShell; ((IConnectionSettingsSecureShell)Terminal.ConnectionSettings).HostAddress = "yourHost.com"; // replace this hard-coded host name with your host name ((IConnectionSettingsSecureShell)Terminal.ConnectionSettings).UserName = "yourUserName"; // replace this hard-coded user name with your user name ((IConnectionSettingsSecureShell)Terminal.ConnectionSettings).SSHPort = 22; ((IConnectionSettingsSecureShell)Terminal.ConnectionSettings).SSHShowBannerDialog = false; ((IConnectionSettingsSecureShell)Terminal.ConnectionSettings).SSHTermWindowAuth = true;*/ Terminal.Connect(); } |
Close the form |
Copy Code
|
---|---|
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { openSystemsTerminalControl1.Terminal.Close(Attachmate.Reflection.CloseOption.CloseNoSave); openSystemsTerminalControl1 = null; } |
Note:
You may see the following compiler warning:
Warning A reference was created to embedded interop assembly 'c:\Windows\assembly\
GAC_MSIL\Reflection\<version>__13bff1b6907eadcf\Reflection.dll' because of an indirect reference to that assembly created by assembly 'c:\Program Files\Attachmate\Reflection\Programmer Interfaces\Attachmate.Reflection.UserControl.IbmHosts.dll'. Consider changing the 'Embed Interop Types' property on either assembly.
The simplest way to resolve this warning is to set the Embed Interop Types property of the ReflectionReference to False. For more about how to resolve this warning, see Technical Note 2579.