As mentioned earlier, the sample clients are for those that are familiar with .NET and are now ready to integrate the TrueGuiInterface.dll into their own .NET applications.
The clients samples create a Telnet connection without a traditional Telnet Client or imbed a Telnet passthru service into an existing application. GuiClient and VbClient are identical except one is written for C# and the other is written for VB. TelnetService.exe provides the Developer with the concept of integrating the passthru feature into their existing application. These projects are a starting point for Developers that wish to make their own client interface. This document will refer to GuiClient but show source code of each.
The GuiClient is a simple approach to building you own interface to connect to a telnet server. As you finish converting all of your application screens you may want to have your own front end. This example shows you how. The connect button establishes a connection to the sample server and the Ctrl C button sends a Ctrl-C break command. But the source is much more interesting to customize.
Customizing GuiClient or vbClient
As you look into the source of the project you will find the code is fairly simple. There is commented code included for use with different methods of connection. Also commented is a method of reading the registry to locate and set your forms location. The initial modification you should make and test is your host address and port definition.
C#:
private void button1_Click(object sender, EventArgs e)
{
if (TrueGui.ConnectToServer(this,"208.127.61.234:8888",true,false))
return;
TrueGui.SendLineToServer("\n");
}
Visual Basic:
If
(TrueGui.ConnectToServer(Me, "208.127.61.234:8888", True, False)) ThenTrueGui.SendLineToServer(
"\n") End If
The server end point address could be modified to point to your server and the SendLineToServer command that follows could relate to your login information and your startup command for your TrueGui server application. You may try one of the alternate methods of ConnectToServer to handle timing issues between startup commands.
Customizing TelnetService
The TelnetService Project is located in the \Alpha Microsystems\TrueGUI\Projects\TelnetService location. Open the TelnetService.csproj for C# express edition or TelnetService.sln for the studio edition. When you start the debugger (F5) it will launch the application. The application will start using the following command line found in the TelnetService properties Debug Tab:
-s"66.166.1.36:8000" -l"127.0.0.1:8000" -debug
When launched, it will start the passthru service. The -s refers to the server endpoint address and the -I refers to the telnet client that you setup in a local loopback mode to connect to the local pc endpoint. The -debug launches the debug window so that you can see that the TelnetService interface is waiting for a telnet application to connect to it. You then see a window from which you could fire off your flavor of telnet client. The parameters of the telnet client will vary based on your package.
As you look into the source of the project you will find the code is fairly simple. It creates a process of which fires off the telnet client when you click the button. Then using the TrueGui.ValidLicense command it verifies your client license. Then it parses the command line and connects to the server.
Editing the sample to handle your system here:
if (TrueGui.SetTelnetMode(this, sTelnetEndPoint, sServerEndPoint, sEnterTrueGuiMode, sLeaveTrueGuiMode, sGetCurrentMode, 0, bShowDebugger, bBreakAtStart))// Set up Telnet mode and return if successful
Your telnet client handling is here:
FileString = tbTelnetClient.Text; int slash = FileString.LastIndexOf("\\"); Process process1 = TelnetProcessor;string
process1.StartInfo.WorkingDirectory = FileString.Remove(slash);
process1.StartInfo.FileName = FileString.Substring(slash + 1);
process1.StartInfo.Arguments = tbTelnetParameters.Text;
process1.StartInfo.CreateNoWindow =
false;process1.StartInfo.WindowStyle =
ProcessWindowStyle.Normal;process1.Start();
TrueGui.TelnetProcess = process1;Or you may simply decide to change the text in the textbox fields with you appropriate settings and use the command line to launch your server.