我正在为Attachmate的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;
答案 0 :(得分:0)
执行此操作的最佳方法是利用现有会话文件(通常在Reflection中加载)。这样您就不必担心主机名,通过代码移植端口。
这是我已成功使用的样板文件。
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.");