LU2 세션을 만든 후, Microsoft.HostIntegration.SNA.Session.ScreenData 및 Microsoft.HostIntegration.SNA.Session.SessionDisplay 개체를 통해 3270 콘솔에서 정보와 메시지를 검색할 수 있습니다.
LU2 연결을 통해 정보 받기
필요한 경우
Microsoft.HostIntegration.SNA.Session.ScreenData을 사용하여 전체 화면을 화면 덤프로 가져옵니다.대부분의 경우 화면에서 모든 정보를 검색할 필요가 없습니다. 대신 대부분의 애플리케이션에 개체를
Microsoft.HostIntegration.SNA.Session.SessionDisplay사용할 수 있습니다.를 호출하여 커서의 위치를 가져옵니다
Microsoft.HostIntegration.SNA.Session.ScreenCursor.필요에 따라
Microsoft.HostIntegration.SNA.Session.SessionDisplay.GetField%2A또는Microsoft.HostIntegration.SNA.Session.SessionDisplay.GetFields%2A메서드나Microsoft.HostIntegration.SNA.Session.SessionDisplay.CurrentField%2A속성을 호출하여 화면 내 다양한 필드에 포함된 위치와 정보를 가져올 수 있습니다.Microsoft.HostIntegration.SNA.Session.SessionDisplay.GetField%2A와Microsoft.HostIntegration.SNA.Session.SessionDisplay.GetFields%2A는 모두 여러 오버로드를 포함하고 있으므로, 귀하가 제공하는 정보에 따라 화면에서 필드 정보를 검색할 수 있습니다. 반면,Microsoft.HostIntegration.SNA.Session.SessionDisplay.CurrentField%2A는 커서가 현재 있는 필드만 나타냅니다.마지막으로, 다양한
SessionDisplay.Wait메서드를 호출하여 필드 업데이트 정보를 받을 수 있습니다.
예시
다음 코드는 Host Integration Server SDK의 3270 애플리케이션에서 가져옵니다. 샘플은 화면 데이터에 액세스하는 데 사용합니다 SessionDisplay.CurrentField.Data .
private void PerformTX_Click(object sender, EventArgs e)
{
try
{
// Disable every button and text box.
DisableEverything();
m_Handler.SendKey("@E");
TraceScreen();
// Wait for screen to calm down.
m_Handler.WaitForSession(SessionDisplayWaitType.NotBusy, 5000);
TraceScreen();
// See if the Balance Field is filled out.
m_Handler.Cursor.Row = m_row;
m_Handler.Cursor.Column = m_column;
TraceScreen();
// Tab to the Account Number field.
m_Handler.SendKey("@T");
TraceScreen();
// Move to the Next Field (Empty Stuff after 123456).
m_Handler.MoveNextField();
TraceScreen();
// Move to the Next Field (Title, Account Balance).
m_Handler.MoveNextField();
TraceScreen();
// Move to the Next Field (Account Balance).
m_Handler.MoveNextField();
TraceScreen();
// Extract Data from this field.
string accountBalance = m_Handler.CurrentField.Data;
// Trim the string.
accountBalance = accountBalance.Trim();
// Only things to do now are clear screen or disconnect.
EnableClearScreen();
// If we failed (not Abended) then this field will be blank.
if (accountBalance.Length == 0)
throw new Exception("Failed to get Account Balance");
else
MessageBox.Show(accountBalance, "Account Balance");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}