Je to uplně jedno, vyzkoušel jsem jich již několik např. tento který mne v klasícké aplikaci bezproblému funguje ale v Windows IoT Core background App bohužel ne:
Imports System.Net.Sockets
Imports System.Threading
Imports System.Text
Public Class MainPage
Inherits Page
Shared client As UdpClient 'Error BC30002 Type 'UdpClient' is not defined.
Shared receivePoint As IPEndPoint 'Error BC30002 Type 'IPEndPoint' is not defined.
Dim readThread As Thread = New Thread(New ThreadStart(AddressOf WaitForPackets))
Sub WaitForPackets()
While True
Dim data As Byte() = client.Receive(receivePoint)
TextBox1.Invoke(Sub()
TextBox1.AppendText(Encoding.ASCII.GetString(data) & vbNewLine)
End Sub)
End While
End Sub
End Class
XAML:
<Grid Background="#1d1d1d" Margin="0,0,0,0" Width="auto" Height="auto">
<StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Center" Height="585" Margin="10,10,10,45" Width="340">
<Button x:Name="UDPbtn" Content="start" Background="White" Margin="10" HorizontalAlignment="Center" Click="StartUdp_Click" Width="320"/>
<TextBox x:Name="UDPMessage" Background="White" BorderBrush="White" Text="" Margin="10" IsReadOnly="True" Height="508"/>
</StackPanel>
</Grid>
|