private void packageData(object obj) { NETcollection netc = obj as NETcollection; List <byte[]> ListData = netc.Datalist; try { int i = 0; int count = ListData.Count; if (count > 0) { int bytesRead = ListData[i] != null ? ListData[i].Length : 0; if (bytesRead == 0) { if (ListData.Count > 0) { ListData.RemoveAt(0); } netc.Ispage = false; return; } ; byte[] tempbtye = new byte[bytesRead]; Array.Copy(ListData[i], tempbtye, tempbtye.Length); try { dtumodle dd = new dtumodle(); dd.Data = tempbtye; dd.Soc = netc.Soc; if (receiveeventDtu != null) { System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(objreceiveeventDtu), dd); } // receiveeventDtu.BeginInvoke(tempbtye, netc.Soc, null, null); if (ListData.Count > 0) { ListData.RemoveAt(i); } netc.Ispage = false; return; } catch (Exception e) { netc.Ispage = false; return; } } } catch (Exception e) { if (netc.Datalist.Count > 0) { netc.Datalist.RemoveAt(0); } netc.Ispage = false; return; } finally { netc.Ispage = false; } }
private void objreceiveeventDtu(object state) { dtumodle dd = state as dtumodle; receiveeventDtu(dd.Data, dd.Soc); }