public ConnectViewModel(TCPConnection connection) { this.connection = connection; OnConnectedChanged(); this.connection.ConnectedChanged += (s, e) => OnConnectedChanged(); this.connection.MessageReceived += (s, e) => OnMessageReceived(e.ReceivedData); this.connection.ConnectionLost += (s, e) => connection.Connect(Port); Port = 4444; }
public static TCPConnection Instance() { if (instance == null) instance = new TCPConnection(); return instance; }