using System;
using System.Collections.Generic;
using System.Text;
using Attachmate.Reflection.Framework;
using Attachmate.Reflection.Emulation.OpenSystems;
using Attachmate.Reflection.UserInterface;
namespace CreateASession
{
class Program
{
static void Main(string[] args)
{
//Start a visible instance of Reflection or get the instance running at the given channel name
Application app = MyReflection.CreateApplication("myWorkspace", true);
//Create a terminal for an Open Systems session
ITerminal terminal = (ITerminal)app.CreateControl(new Guid("{BE835A80-CAB2-40d2-AFC0-6848E486BF58}"));
//Specify the connection type, host name (or IP address), and connect.
IConnectionSettingsTelnet conn = (IConnectionSettingsTelnet)terminal.ConnectionSettings;
conn.HostAddress = "sylvester";
terminal.Connect();
//Create a View to make the session visible
IFrame frame = (IFrame)app.GetObject("Frame");
frame.CreateView(terminal);
IThemeColor screenColor = terminal.Theme.Color;
//Get integers that are mapped to the background and foreground colors
int bgColor = screenColor.GetBackgroundColorAsInt(TextColorMappingAttribute.Plain);
int fgColor = screenColor.GetForegroundColorAsInt(TextColorMappingAttribute.Plain);
//Set the colors that are mapped to these values
screenColor.SetColorRGB(bgColor, 255, 0,0);
screenColor.SetColorRGB(fgColor, 0, 0, 255);
}
}
}