maui-app-lifecycle

仓库创建 2026年2月4日最近提交 18 小时前SkillHot 收录 20 天前
▸ 精选理由

梳理平台差异与保存恢复模式,便于正确处理后台/恢复场景。

这个 Skill 做什么

提供 .NET MAUI 应用与窗口跨平台生命周期事件、状态保存与恢复的指导。

讲清楚 .NET MAUI 应用和 Window 的跨平台生命周期怎样工作,什么时候保存/恢复状态以及各平台事件如何对应。会在需要处理后台挂起、恢复、窗口激活/停用等场景时用到,帮你选对 OnStopped/OnResumed 等钩子。亮点是把平台差异和状态持久化模式都讲明白,方便统一写跨平台代码。

▸ 展开 SKILL.md 英文原文

.NET MAUI app lifecycle guidance — the four app states, cross-platform Window lifecycle events (Created, Activated, Deactivated, Stopped, Resumed, Destroying), platform-specific lifecycle mapping, backgrounding and resume behavior, and state-preservation patterns. USE FOR: "app lifecycle", "window lifecycle events", "save state on background", "resume app", "OnStopped", "OnResumed", "backgrounding", "deactivated event", "ConfigureLifecycleEvents", "platform lifecycle hooks". DO NOT USE FOR: navigation events (use maui-shell-navigation), dependency injection setup (use maui-dependency-injection), platform API invocation (use conditional compilation and partial classes).

开发编程生命周期MAUI状态管理通用
4.8k
Stars
351
Forks
40
仓库内 Skill
+610
7 日增星
安装 / 使用
给你的 Agent 一句话(通用)
帮我安装这个 skill:https://raw.githubusercontent.com/dotnet/skills/main/plugins/dotnet-maui/skills/maui-app-lifecycle/SKILL.md
或 curl 直取 SKILL.md
curl -fsSL "https://raw.githubusercontent.com/dotnet/skills/main/plugins/dotnet-maui/skills/maui-app-lifecycle/SKILL.md"
SKILL.MD 节选查看完整文件 ↗
# .NET MAUI App Lifecycle

Handle application state transitions correctly in .NET MAUI. This skill covers the cross-platform Window lifecycle events, their platform-native mappings, and patterns for preserving state across backgrounding and resume cycles.

## When to Use

- Saving or restoring state when the app backgrounds or resumes
- Subscribing to Window lifecycle events (Created, Activated, Deactivated, Stopped, Resumed, Destroying)
- Hooking into platform-native lifecycle callbacks via `ConfigureLifecycleEvents`
- Deciding where to place initialization, teardown, or refresh logic
- Understanding the difference between Deactivated and Stopped

## When Not to Use

- Page-level navigation
via SKILL·HOT · 数据来自 GitHub 公开信息 · 原文版权归作者所有