方法停用和 TryClose - Caliburn.Micro

发布于 2024-10-09 22:19:03 字数 484 浏览 0 评论 0原文

如果有人解释我在 MVVM 框架 Caliburn.Micro 中 Deactivate 和 TryClose 方法之间的“差异”,我将非常感激。

例如,我的应用程序具有以下结构:

  • Shell(WPF 窗口)
    • SomeScreen(用户控制)- 处于活动状态

我知道该方法是 Deactivate,如果屏幕停用,则每次都会调用该方法。 TryClose 方法用于尝试关闭某些屏幕。

我的问题是:

  1. 我单击 WPF 窗口上的 X 按钮。 首先是调用方法 deactivate on SomeScreen 对象,然后被调用 Shell 对象上有同样的方法吗?

    deactivate方法后对象完全被销毁了吗? - “删除对他的引用”?

  2. 当我关闭 WPF 窗口(即 shell)时,它会调用 IConductor 中的方法?

I would be very grateful if someone explain my "differences" between method Deactivate and TryClose in MVVM framework Caliburn.Micro.

For example my app has this structure:

  • Shell (WPF window)
    • SomeScreen (User control) - is active

I know that method is Deactivate is call everytime if is screen deactivated. An method TryClose is used on attempt to close some screen.

My questions are:

  1. I click on X button on WPF window.
    First is call method deactivate on
    SomeScreen object and then is call
    the same method on Shell object ?

    After deactivate method is totally object destroyed? - "remove reference on him"?

  2. When I close WPF window which is shell it call wich methods from IConductor ?

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

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

发布评论

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

评论(1

计㈡愣 2024-10-16 22:19:03

这已在 Caliburn Micro 的最近更新中进行了更改。

只有 Deactivate 方法现在可以选择使用 bool 来表示它是否正在关闭。

This has been changed in a recent update to Caliburn Micro.

There's just the Deactivate method now that can optionally take a bool to say whether it is closing or not.

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