0

我正在为 Attachmate's Reflection for IBM 2014 编写一个外部应用程序,在该应用程序中,我正在尝试使用现有会话文件创建 relfection 应用程序。该应用程序已成功创建,但对用户不可见,我尝试了几种方法来做到这一点,但还没有运气。

如果有人这样做或知道需要做什么才能使终端可见,请回复。

以下是我用来执行此操作的一段代码,

using Attachmate.Reflection;
using Attachmate.Reflection.Framework;
using Attachmate.Reflection.Emulation.IbmHosts;
using Attachmate.Reflection.UserControl.IbmHosts;
using Attachmate.Reflection.UserInterface;

Application reflectionApplication;
reflectionApplication = MyReflection.CreateApplication("app", true);
IIbmTerminal terminal =(IIbmTerminal)reflectionApplication.CreateControl(@"C:\mypath\test.rd3x");

reflectionApplication = MyReflection.ActiveApplication;
IFrame frame = (IFrame) reflectionApplication.GetObject("Frame");
frame.Visible = true;
4

1 回答 1

0

最好的方法是利用现有的会话文件(通常会在反射中加载)。这样您就不必担心主机名、端口通过代码。

这是我已经成功使用的样板。

Attachmate.Reflection.Framework.Application reflectionApplication = null;

reflectionApplication = MyReflection.CreateApplication("myWorkspace", true);
if (reflectionApplication != null)
{
    IIbmTerminal terminal = (IIbmTerminal)reflectionApplication.CreateControl(
        @"C:\ProgramData\Attachmate\Reflection\<your session file>.rd3x");
    if (terminal != null)
    {
        terminal.Connect();
        //You can also use AfterConnect event to wait for the connection.
        while (!terminal.IsConnected)
        {
            System.Threading.Thread.Sleep(500);
        }

        IView sessionView;
        IFrame theFrame = (IFrame)reflectionApplication.GetObject("Frame");
        sessionView = theFrame.CreateView(terminal);

        IIbmScreen screen = terminal.Screen;
        screen.WaitForHostSettle(6000, 3000);
    }
    else
        Console.WriteLine("Can not create the control.");
}
else
    Console.WriteLine("Failed to get Application object.");
于 2016-01-13T03:21:05.440 回答