创建连接后,可以通过 LU2 连接将信息发送到远程显示器。
使用 LU2 事务集成器发送消息
如有必要,请通过调用其中一个
SessionDisplay.Move
方法,将光标移动到要在屏幕上写入的位置。Microsoft.HostIntegration.SNA.Session.SessionDisplay
包含各种Microsoft.HostIntegration.SNA.Session.SessionDisplay.MoveCursor%2A
、Microsoft.HostIntegration.SNA.Session.SessionDisplay.MoveNextField%2A
、Microsoft.HostIntegration.SNA.Session.SessionDisplay.MovePreviousField%2A
和Microsoft.HostIntegration.SNA.Session.SessionDisplay.MoveToField%2A
重载。 这些重载使你能够将光标移动到屏幕的不同部分,具体取决于你提供的信息。这些
SessionDisplay.Move
方法通过一组SessionDisplay.Get
类似的方法进行镜像,使你能够检索光标的位置,以及屏幕上不同字段中包含的信息。使用
SessionHandler.sendKey
调用将信息发送到当前游标位置。sendKey
将指定的字符串发送到光标标记的屏幕上的位置。 如果没有可用的游标位置,sendKey
请向默认位置发送信息。
示例:
以下代码来自 SDK 示例目录中的 3270 应用程序。 在此示例中,开发人员假定光标位于屏幕上的默认位置,因此不确认光标位置。
private void ConnectCICS_Click(object sender, EventArgs e)
{
try
{
CICSName.Text = CICSName.Text.Trim();
if (CICSName.Text.Length == 0)
{
MessageBox.Show("You must fill out the CICS Name");
return;
}
// Disable every button and text box.
DisableEverything();
m_Handler.SendKey(CICSName.Text + "@E");
TraceScreen();
m_Handler.WaitForSession (SessionDisplayWaitType.PLUSLU, 5000);
TraceScreen();
m_Handler.WaitForContent(@"DEMONSTRATION", 20000);
TraceScreen();
// Enable clear screen.
EnableClearScreen();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}