从控制台应用程序打开 wpf 应用程序并将对象传递给它

发布于 2024-08-21 17:50:53 字数 78 浏览 3 评论 0原文

我们想从控制台应用程序打开一个 wpf 应用程序,并将在控制台应用程序中初始化的对象传递给 wpf 应用程序。只是想知道这是否可能。 谢谢 氮

We would like to open a wpf app from a console app and pass objects which were initialized in the console app to the wpf app. Just wondering if this is possible.
Thanks
N

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

强者自强 2024-08-28 17:50:53

您可以使用命令行并将序列化对象作为参数传递,但这仅在您启动 wpf 应用程序时有效 1 次。

如果您需要保持两者之间的持续对话,您将需要在 wpf 应用程序中托管一个 wcf 服务并以这种方式与之对话。

IMO 在 WPF 应用程序中托管服务是最好的方法。

You could use the command line and pass serialized objects as arguments but this will only work 1 time, when you start the wpf app.

If you need to maintain an ongoing conversation between the two you will need to host a wcf service in the wpf app and talk to it that way.

IMO hosting a service in the WPF app is the best way to go.

入画浅相思 2024-08-28 17:50:53

您可以像任何其他类一样在 wpf 窗口的构造函数中传递对象。

例如: Window1 window = new window1(myObject);

You can pass objects in the constructor of your wpf window just like any other class..

Ex: Window1 window = new window1(myObject);

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文