深入探索Windows Phone平台开发:设备信息、任务与数据处理
1. 网络连接与设备信息获取
在Windows Phone平台开发中,网络连接的处理至关重要。当尝试建立连接时,相关结果会在 socketEventArg_Completed 事件处理程序中触发。以下是具体代码:
void socketEventArg_Completed(object sender, SocketAsyncEventArgs e)
{
// When ConnectAsync is called, the socket object is passed in as part
// of the socketEventArg UserToken value.
Socket socket = e.UserToken as Socket;
if (e.SocketError == SocketError.Success)
{
PhoneNetworkApi.NetworkInterfaceInfo netInterfaceInfo =
socket.GetCurrentNetworkInterface();
Dispatcher.BeginInvoke(() =>
{
SocketInterfaceNameTextBlock.Text = netInterfaceInfo.InterfaceName;
SocketInterfaceNam
超级会员免费看
订阅专栏 解锁全文
967

被折叠的 条评论
为什么被折叠?



