I was creating an application wich send data over the network from client to server.
(An application for calling somebody over a network , like a bell on a housedoor).
I created a thread wich connects the server and client , i wanted to refresh a label in the statusbar of the server-side application wich displayed the operation that was working.
In c# the most common thing you can do is this :
1. Create a delegate for your function you want to use in the invoke thread.private delegate void UpdateLogCallback(string strMessage);
2. Update the form, you can use this.invoke
this.Invoke(new UpdateLogCallback(this.UpdateLog), new object[] { “Connected Successfully!” });
3. the function wich is called from the connection-thread :private void UpdateLog(string strMessage)
{
lblsts.Text(strMessage);
}
In WPF you can’t use the invoke method after this.
To work arround this you can use the the Invoke methods on the associated dispatcher :lblSts.Dispatcher.Invoke(new UpdateLogCallback(this.UpdateLog), new object[] { “Connected Successfully!” });
相关推荐
WPF调用Winform 的控件WPF调用Winform 的控件WPF调用Winform 的控件
Winform与WPF窗体互相调用方法 包括Winform调用WPF窗体和WPF调用Winform窗体。
wpf项目调用WinForm项目,将WinForm程序内嵌到wpf程序中,都是网上找到的代码,大家相互学习,相互指正。已经控制固定分数下载。
在Winform中嵌入WPF的控件或者窗體實例
WPF 与 WinForm 调用系统右键菜单/资源管理器右键菜单/桌面右键菜单示例 内含 WPF 与 WinForm 示例
用WPF做了一个登录页面,用Winform做了一个主界面,运行时先进行登录页面,再进入主界面。登录账号:apple,登录密码:123456。试运行之前先生成
WPF对比WinForm简单实例,这个例子主要展示同一个需求用WinForm和WPF分别进行实现,通过这个例子,我们可以看到两者之间的区别和联系,同时也可以对我们的项目选型带来一定的参考作用
公司项目使用WPF开发,需要整合之前的Winform新界面,故需要Wpf与Winform页面互相打开交互操作,网上搜不到此类资源,自己琢磨出来的,希望对需要的人有帮助,我已把分调到最低。
Winform窗体嵌入WPF程序并发送消息
Winform调用WPF控件,演示WPF的DataGrid控件在Winform中如何调用刷新
WPF和WinForm集成MiniBlink49版本,支持.NetFramework4.0,支持xp、win7、win10 miniblink49版本是谷歌57版本内核,兼容react、vue等网站。
winform调用全局wpf资源样式,可以调用相对路径的xaml也可以调用绝对路径的xaml。
【原创】AutoUpdate软件自动更新,兼容wpf、winform,各项更新进度,更新内容说明等等,用户体验度上还不错!预览地址:https://blog.csdn.net/xukai515786/article/details/103727707
通过委托,实现WPF和WinForm的非界面线程向界面线程访问。
利用WPF建立自适应窗口大小布局的WinForm窗口[参照].pdf
单独设计的文件夹选择框,比系统的FolderBrowserDialo可以更快地显示系统盘符下的文件夹列表。自定义的文件路径选择框,适用于C#语言的WPF和WinForm。
使用Aforge类库实现打开本地摄像头拍照,其中有WinForm和WPF两个demo,不建议使用WPFMediaKit.dll 为类库的 实例demo,因为WPFMediaKit 打开摄像头有限制,部分可以打开,部分不能打开
使用WPF嵌入winform控件时,winform控件始终显示在窗口正上方,使用该资源可解决
C# WPF winform读取电子称重量