static void Main(string[] args) { //Create Telnet service TelnetService _telnetService = new TelnetService( new TCPServer(), //Multi client TCP server new ITelnetCommand[] //Custom commands we implemented { new HelloCommand(), new EchoCommand() }); //Settings for the Telnet service TelnetServiceSettings _telnetSettings = new TelnetServiceSettings(); _telnetSettings.PromtText = "SampleApp@" + Environment.MachineName; _telnetSettings.PortNumber = 32202; _telnetSettings.Charset = Encoding.Default.CodePage; //Start listening for incoming connections _telnetService.Start(_telnetSettings); Console.WriteLine("Telnet Service is running.\r\nPress enter to stop application."); Console.ReadLine(); //Stop service. Always stop the service when the application is shutting down. _telnetService.Stop(); }
public UIService(ConfigurationItems configurationItems, CommandService commandService, ExecutionService executionService, TelnetService telnetService) { _telnetService = telnetService; var entryAssembly = Assembly.GetEntryAssembly() ?? Assembly.GetCallingAssembly(); _systemId = entryAssembly.GetName().Name; Thread.CurrentThread.Name = _systemId; _trayContainer = new Container(); _notifyIcon = new NotifyIcon(_trayContainer) { ContextMenuStrip = new ContextMenuStrip(), Icon = GetIcon(entryAssembly, configurationItems.IconName), Text = _systemId, Visible = true }; _notifyIcon.ContextMenuStrip.Opening += Context_OnMenuOpen; _notifyIcon.DoubleClick += Context_TrayIcon_OnDoubleClick; _notifyIcon.ContextMenuStrip.Items.Clear(); _connectionCountTimer = new Timer { Enabled = _telnetService != null, Interval = 1000 }; _connectionCountTimer.Tick += Timer_ConnectionCount; _exitTimer = new Timer { Enabled = false, Interval = 500 }; _exitTimer.Tick += Timer_Exit; commandService.Init(); executionService.Init(); }
public TelnetConnectionHandler(TelnetService telnetService) { _telnetService = telnetService; }