private void TelnetDisplayStartup(
            ServerConnectPack ConnectPack, NegotiateSettings NegotiateSettings,
            ConcurrentMessageQueue TelnetQueue,
            FromThread FromThread, ToThread ToThread,
            Window ClientWindow, Action <bool, TypeTelnetDevice?> TelnetStartupComplete)
        {
            // initial telnet back and forth negotiation with server.
            var rv = TelnetConnection.TelnetConnectAndNegotiate(
                ConnectPack.HostName, NegotiateSettings,
                TelnetQueue, ToThread);
            var sessionSettings = rv.Item1;

            ConnectPack.Settings = sessionSettings;

            // read the dataStreamHeader from the Telnet thread.
            // this message contains the startup up code ( I902 ), system name and
            // printer name.  The next message from the server will be sent when there
            // is a spooled file ready to print.
            var attrMsg = TelnetQueue.WaitAndDequeue() as TelnetDeviceAttrMessage;

            if (attrMsg != null)
            {
                // signal startup is complete to the telnet window on the UI thread.
                var bi = ClientWindow.Dispatcher.BeginInvoke(
                    DispatcherPriority.Input, new ThreadStart(
                        () =>
                {
                    TelnetStartupComplete(true, attrMsg.TypeDevice);
                }));
            }
        }
 public ConnectThread(
     ExtendedManualResetEvent ShutdownFlag,
     FromThread FromThread, ToThread ToThread,
     SessionSettings Settings)
     : base(ShutdownFlag)
 {
     this.FromThread      = FromThread;
     this.ToThread        = ToThread;
     this.SessionSettings = Settings;
     this.InputQueue      = new ConcurrentMessageQueue();
 }