WCF, Accessing a windows forms controls from a service

后端 未结 5 781
南旧
南旧 2021-01-05 22:17

I have a WCF service that is hosted inside a Windows Form.

How can I access the controls of the form from the methods in my service?

for example I have

5条回答
  •  执念已碎
    2021-01-05 23:13

    For completeness, there is a simpler approach using the same solution.

    You can directly invoke a delegate on the same thread using the invoke method.

    Invoke(new MethodInvoker(delegate{FormTextBox.Text = message;});
    

提交回复
热议问题