Show Contents / Index / Search

Make a Session Visible in a View

In this task, you'll add a View object (session view) to a control object to make a session visible. View and Frame objects provide Reflection 2011 user interface elements to a custom application. You must create a control object (that is, a terminal session) before you can add a View object.

Initially, the name property of a View object is empty so that you have the option to set your own identifying string. For a list of the different methods by which you can identify (and get) View objects, see Terminal and View Objects.

To create a view

  1. Start Reflection 2011, create a session document, and connect to the host.
  2. Name and save the session document to a trusted location, and then close it, but leave Reflection 2011 running.
  3. In Visual Studio, create a new Console Application project.
  4. In the New Project dialog box, type Make Session Visible in the Name box.
  5. Select the Create directory for solution box, click Browse to select your API projects folder (for example, C:\MyProjects), and then click OK.
  6. In Solution Explorer, add the class assemblies. (For instructions, see Create an API Project.)
  7. Copy the code from one of the following programs:

    Make Session Visible (IBM)

    Make Session Visible (OpenSystems)

  8. In Visual Studio, paste the code to the Program.cs tab, replacing all existing code.

    This program includes the following calls to get View and Frame objects:

    IView sessionView;

    IFrame theFrame = (IFrame)reflectionApplication.GetObject("Frame");

    sessionView = theFrame.CreateView(terminal);

  9. In the code, change the parameter for reflectionApplication.GetControlsByFilePath to the complete path of your saved session document. Between the quotation marks, type the path exactly as it appears, including the drive letter (for example, C:\), any spaces, and the filename and extension of the session document.
  10. Build the application (Build > Rebuild Solution) and then run it (Debug > Start Without Debugging).

    A new session document should appear in the Reflection 2011 workspace.

    Note: To re-create a View object after closing it, you must first re-create the control object that will be associated with the View.