[英]Bind Data after TCP receive
I have this strange problem all day now. 我整天都遇到这个奇怪的问题。 I dunno if you handled something similar.
我不知道你是否处理过类似的事情。 I used two different serializers and now i know its not this problem.
我使用了两个不同的序列化器,现在我知道它不是这个问题。
Im sending some data over TCP Sockets. 我通过TCP套接字发送一些数据。 Serialize -> Send -> Deserialize, everything works ok, i can get my objects search through them, use they're properties!
序列化->发送->反序列化,一切正常,我可以通过它们搜索我的对象,使用它们为属性! But, if eg receive a
BusinessObject[]
and convert into List<BusinessObject>
, then bind the list in a Control.DataSource = businessObjectList;
但是,例如,如果接收到
BusinessObject[]
并转换为List<BusinessObject>
,则将该列表绑定到Control.DataSource = businessObjectList;
BOOM! 繁荣!
NotSupportedException
. NotSupportedException
。
Tried it with 3 different controls. 尝试了3种不同的控件。 Same behaviour.
相同的行为。 My head is empty of ideas right now!!
我的脑袋现在空无一物! The Send TCP happens on Desktop Framework, Receive on Compact Framework.
发送TCP发生在桌面框架上,接收发生在Compact Framework上。 But i dont think this has to do with anything.
但是我不认为这与任何事情有关。
I wish for an explanation on this! 我希望对此做出解释!
Re cross-thread error... simply don't try binding from the wrong thread! 重新跨线程错误...根本不要尝试从错误的线程进行绑定! You'll have to switch back to the main thread for UI updates, sorry.
抱歉,您必须切换回主线程以进行UI更新。 As it happens I have used a cross-thread safe list in the past (for whatever meaning "safe" has when multiple threads are mutating the same list... it raises notification events on the UI thread, I mean) - but it certainly won't work on CF.
碰巧的是,我过去使用过一个跨线程安全列表(因为当多个线程对同一个列表进行变异时,“安全”的含义是什么……我的意思是,它在UI线程上引发了通知事件)-但它当然可以在CF上将无法使用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.