The InfoConnect Windows Presentation Foundation (WPF) Terminal User Control can be embedded in your WPF applications to provide a terminal screen on a window along with another application or a different data source. This control renders a terminal emulator session within a given WFP application.
With the View selected, open the Properties window and enter the name for the control. ( In the example, we'll use ibmTerminalControl1 for an IBM terminal control.)
Change:
<Grid>
<IbmHosts:IbmTerminalControl x:Name="ibmTerminalControl1"
HorizontalAlignment="Left" Margin="191,188,0,0"
VerticalAlignment="Top"/>
</Grid>
To:
<Grid>
<IbmHosts:IbmTerminalControl x:Name="ibmTerminalControl1" />
</Grid>
public partial class MainWindow : Window { private bool isInitialized = false; public MainWindow() { InitializeComponent(); } private void Window_Loaded(object sender, RoutedEventArgs e) { //Make sure InitInstance is only called once if (!isInitialized) { ibmTerminalControl1.InitInstance(Attachmate.Reflection.UserControl.Wpf.IbmHosts.HostType.IBM3270); isInitialized = true; } } }
private void ibmTerminalControl1_TerminalInitializedEvent(object sender, System.ComponentModel.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 = "zos.efglobe.com"; ibmTerminalControl1.IbmTerminal.Port = 23; ibmTerminalControl1.IbmTerminal.Connect(); }
With the View selected, open the Properties window and enter the name for the control. ( In the example, we'll use openSystemsTerminalControl1 for an Open Systems control.)
Change:
<Grid> <OpenSystems:OpenSystemsTerminalControl x:Name="openSystemsTerminalControl1" HorizontalAlignment="Left" Height="138" Margin="125,88,0,0" VerticalAlignment="Top" Width="251"/> </Grid>
To:
<Grid>
<OpenSystems:OpenSystemsTerminalControl x:Name="openSystemsTerminalControl1" />
</Grid>
public partial class MainWindow : Window { private bool isInitialized = false; public MainWindow() { InitializeComponent(); } private void Window_Loaded(object sender, RoutedEventArgs e) { //Make sure InitInstance is only called once if (!isInitialized) { openSystemsTerminalControl1.InitInstance(); isInitialized = true; } } private void openSystemsTerminalControl1_TerminalInitializedEvent(object sender, System.ComponentModel.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 hardcoded 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 hardcoded host name with your host name ((IConnectionSettingsSecureShell)Terminal.ConnectionSettings).UserName = "yourUserName"; // replace this hardcoded user name with your user name ((IConnectionSettingsSecureShell)Terminal.ConnectionSettings).SSHPort = 22; ((IConnectionSettingsSecureShell)Terminal.ConnectionSettings).SSHShowBannerDialog = false; ((IConnectionSettingsSecureShell)Terminal.ConnectionSettings).SSHTermWindowAuth = true;*/ Terminal.Connect(); } }
using Attachmate.Reflection.Emulation.OpenSystems;
private void openSystemsTerminalControl1_TerminalInitializedEvent(object sender, System.ComponentModel.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; ((IConnectingSettingsBestNetwork)Terminal.ConnectionSettings).HostAddress = "yourHostName"; Terminal.Connect(); }