Using the Open Systems Terminal User Control
The Reflection Open Systems Terminal User Control 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.
Note: When creating applications on a 64-bit machine and using Reflection 2011 "Terminal Controls", make sure the application target is set to "x86" instead of "Any CPU" or "x64". This is required because a 64-bit application does not work directly with 32-bit controls. If the build target (Platform) is not set to "x86", the "COMException: class not registered" error is displayed during runtime.
To set up the Open Systems User Control
- In the Visual Studio New Project wizard, create a "Windows Form Application."
- In Form Design view, drag and drop the OpenSystemsTerminalControl from the Toolbox to Form1.
Note: The required assemblies are automatically added to the project references after you add the control to the form.
- In Form designer, double-click on Form1. This adds the default Form event handler, which is Load event. Then add a call to InitInstance to initialize the terminal control.
private void Form1_Load(object sender, EventArgs e)
- Add the following using directive:
- Back in the Form designer, select the openSystemsTerminalControl1 control you added and then in the Properties view, set the Dock property to Fill. This allows the control to fill the Form. Resizing of the form resizes the contained terminal control at runtime. This is ideal for resizing the Terminal view, but not required.
- Double-click on the OpenSystemsTerminalControl1 control. This adds an event handler for the openSystemsTerminalControl1 TerminalInitializedEvent event. This event is fired after the terminal is initialized from the InitInstance call (made after the form loads).
- In code view for Form1.cs, add the event handler code as follows. The following code sets the host address and connects to the host.
private void openSystemsTerminalControl1_TerminalInitializedEvent(object sender, AsyncCompletedEventArgs e)
ITerminal Terminal = openSystemsTerminalControl1.Terminal;
((IConnectingSettingsBestNetwork)Terminal.ConnectionSettings).HostAddress = "yourHostName";
Note: For details on the Terminal object returned from the Terminal control, see the Reflection .NET API Help.
- Build and run the solution. At runtime, you should get a form that renders a terminal host.
Note: If you are developing an application with Visual Studio 2010 that is targeted to the .NET 4.0 framework, you may see the following compiler warning:
warning CS1762: A reference was created to embedded interop assembly 'c:\WINDOWS\assembly\GAC_MSIL\Reflection2\220.127.116.11__13bff1b6907eadcf\Reflection2.dll' because of an
indirect reference to that assembly created by assembly 'c:\Program Files\Attachmate\Reflection\Programmer Interfaces\Attachmate.Reflection.UserControl.OpenSystems.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 Reflection2 Reference to False. For more about how to resolve this warning, see Technical Note 2579.