/// <summary> /// Initialize the control view model /// </summary> public ControlViewModel(IListenerTcp listenerTcp, ITcpClient tcpClient, IMcu mcu) { SendDeveloperCommand = new DelegateCommand(DeveloperCommandToMcuAsync); StartTcpListenerCommand = new DelegateCommand(ToggleTcpListener); ConnectToTcpServerCommand = new DelegateCommand(ConnectToTcp); Mcu = mcu; ListenerTcp = listenerTcp; TcpClient = tcpClient; }
} // proc OnBeginReadConfiguration protected override void OnEndReadConfiguration(IDEConfigLoading config) { base.OnEndReadConfiguration(config); var listenerAddress = Config.GetAttribute("address", "0.0.0.0"); var listenerPort = Config.GetAttribute("port", serverCertificate == null ? 3305 : 6619); skipInvalidCertificate = Config.GetAttribute("skipInvalidCertificate", false); clientCertificateRequired = Config.GetAttribute("clientCertificateRequired", true); sslProtocols = (SslProtocols)Config.GetAttribute("sslProtocols", (int)defaultSslProtocols); Log.Info("Register Listener (port={0}, addr={1}, ssl={2})", listenerPort, listenerAddress, serverCertificate == null ? "<plain>" : serverCertificate.Subject); var endPoint = new IPEndPoint(IPAddress.Parse(listenerAddress), listenerPort); // start the listener Procs.FreeAndNil(ref currentListener); currentListener = serverTcp.RegisterListener(endPoint, serverCertificate != null ? new Action<Stream>(CreateSslHandler) : new Action<Stream>(CreateHandler) ); } // proc OnEndReadConfiguration
} // proc OnBeginReadConfiguration protected override void OnEndReadConfiguration(IDEConfigLoading config) { base.OnEndReadConfiguration(config); var listenerAddress = Config.GetAttribute("address", "0.0.0.0"); var listenerPort = Config.GetAttribute("port", serverCertificate == null ? 3305 : 6619); skipInvalidCertificate = Config.GetAttribute("skipInvalidCertificate", false); clientCertificateRequired = Config.GetAttribute("clientCertificateRequired", true); sslProtocols = (SslProtocols)Config.GetAttribute("sslProtocols", (int)defaultSslProtocols); Log.Info("Register Listener (port={0}, addr={1}, ssl={2})", listenerPort, listenerAddress, serverCertificate == null ? "<plain>" : serverCertificate.Subject); var endPoint = new IPEndPoint(IPAddress.Parse(listenerAddress), listenerPort); // start the listener Procs.FreeAndNil(ref currentListener); currentListener = serverTcp.RegisterListener(endPoint, serverCertificate != null ? new Action <Stream>(CreateSslHandler) : new Action <Stream>(CreateHandler) ); } // proc OnEndReadConfiguration