Show Contents / Index / Search

Control Multiple Reflection Frames

//This sample code is intended to illustrate a concept, and it shows only the code that is relevant to that concept.

//It may not meet the security requirements for a specific environment, and it should not be used exactly as shown.

//We recommend that you add security and error-handling code to make your projects more secure and robust.

//Attachmate provides this sample code "AS IS" with no warranties.

 

using System;

using System.Collections.Generic;

using System.Text;

using Attachmate.Reflection;

using Attachmate.Reflection.Emulation.IbmHosts;

using Attachmate.Reflection.Framework;

using Attachmate.Reflection.UserInterface;

using Attachmate.Reflection.Emulation.OpenSystems;

namespace StartReflection

{

  class Program

    {

      static Guid instanceID;

      static void Main(string[] args)

      {

      //Start Reflection

      instanceID = MyReflection.Start("WorkSpace1");

      //Connect to the running Reflection Workspace

      Attachmate.Reflection.Framework.Application reflectionApplication1 =

      MyReflection.CreateApplication("WorkSpace1");

      //Create a New IBM Session

      IIbmTerminal terminal1 = (IIbmTerminal)reflectionApplication1.CreateControl(new

      Guid("{09E5A1B4-0BA6-4546-A27D-FE4762B7ACE1}"));

      //Create a View, making Reflection visible to user

      IView sessionView1;

      IFrame theFrame1 = (IFrame)reflectionApplication1.GetObject("Frame");

      sessionView1 = theFrame1.CreateView(terminal1);

      sessionView1.TitleText = "Your IBM session";

      //Start a second Workspace

      instanceID = MyReflection.Start("WorkSpace2");

      //Connect to the running Reflection Workspace

      Attachmate.Reflection.Framework.Application reflectionApplication2 =

      MyReflection.CreateApplication("WorkSpace2");

      //Create a New Open Systems Session

      ITerminal terminal2 = (ITerminal)reflectionApplication2.CreateControl(new

      Guid("{BE835A80-CAB2-40d2-AFC0-6848E486BF58}"));

      //Create a View, making Reflection visible to user

      IView sessionView2;

      IFrame theFrame2 = (IFrame)reflectionApplication2.GetObject("Frame");

      sessionView2 = theFrame2.CreateView(terminal2);

      sessionView2.TitleText = "your Open Systems Session";

      }

    }

}