UWP用选取文件对话框
文件选取器、获取文件属性、写入和读取、保存读取和删除应用数据
UWP判断文件是否存在
UWP网络连接中用到异步处理接收数据的方法
/// <summary>
/// 开始接收数据 /// </summary> public void StartRecive() { DataReaderLoadOperation drlo = tcpinput.LoadAsync((uint)buffer.Length); drlo.Completed = new AsyncOperationCompletedHandler<uint>(DataReadHandler); }/// <summary>
/// 用.net core实现接收信息 /// </summary> /// <param name="operation"></param> /// <param name="status"></param> public void DataReadHandler(IAsyncOperation<uint> operation, AsyncStatus status) { uint dd1; int iii = 0; int length; try { if (status == AsyncStatus.Completed) {length = (int)operation.GetResults();
byte[] data = new byte[length]; tcpinput.ReadBytes(data); Buffer_Manager(data); DataReaderLoadOperation drlo = tcpinput.LoadAsync((uint)buffer.Length); drlo.Completed = new AsyncOperationCompletedHandler<uint>(DataReadHandler);}
else { } } catch (Exception ex) { return; } }其中当远程关闭连接或关闭程序时,status的值为error,而不是触发异常,与.net中socket的机制不一样