4
Follows the code:
private async void button_1_Click(object sender, RoutedEventArgs e)
{    
    var listenPort = 11000;
    var listener = new TcpSocketListener();
    listener.ConnectionReceived += async (senders, args) =>
    {
        var client = args.SocketClient;
        var reader = new StreamReader(client.ReadStream);
        var data = await reader.ReadLineAsync() + "\n";
        var split = data.Split('#');
        button_proximo.RaiseEvent(new RoutedEventArgs(System.Windows.Controls.Primitives.ButtonBase.ClickEvent));
        var bytes = Encoding.UTF8.GetBytes(data);
        await client.WriteStream.WriteAsync(bytes, 0, bytes.Length);
        await client.WriteStream.FlushAsync();
    };
    await listener.StartListeningAsync(listenPort);
}
The mistake I get:
System.Invalidoperationexception: 'The call thread cannot access this object because it belongs to a different thread.'
This mistake happens only inside ConnectionReceived, if I put the line button_proximo.RaiseEvent(new RoutedEventArgs(System.Windows.Controls.Primitives.ButtonBase.ClickEvent)); outside the ConnectionReceived works normal.
Some solution ?