[英]A signal/slot system like Qt with Wpf and c#
I would like to know if there is a similar system like the signal/slot of Qt in Wpf/c# 我想知道在Wpf / c#中是否存在类似Qt的信号/插槽的类似系统
In other words, this is I would like to have : 换句话说,这是我想要的:
myView.cs myView.cs
public partial class myWindow :Window
{
protected MyLambdaCollectionVM _myLambdaCollection;
public myWindow ()
{
InitializeComponent();
_myLambdaCollection = new MyLambdaCollectionVM ();
connect(this._myLambdaCollection, (SIGNAL(WhenIAddAnObject(str fileName)), SLOT(this.funcCalledWhenIaddAnObject(str fileName)));
}
}
connect(...)
is a Qt style signal/slot. connect(...)
是Qt风格的信号/插槽。
I've try binding method, but in my case, I need to create dynamically images (so not in Xaml but in C#) and I didn't find how to realize a C# to C# binding in WPF. 我尝试了绑定方法,但在我的情况下,我需要创建动态图像(所以不是在Xaml中而是在C#中),我没有找到如何在WPF中实现C#到C#绑定。
in C# it it is called ?Events and Delegates and connect is replaced with something called event wiring. 在C#中它被调用?事件和代理和连接被称为事件连接的东西取代。
myEventSource.EventName += new delegate(method to be called);
This is a roughly how it looks like in C# 这大致是C#中的样子
Try taking a look at TPL Dataflow. 试着看一下TPL Dataflow。 http://msdn.microsoft.com/en-us/library/hh228603.aspx http://msdn.microsoft.com/en-us/library/hh228603.aspx
Examples exist for GUI applications. 存在GUI应用程序的示例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.