【发布时间】:2018-05-09 15:52:20
【问题描述】:
我已经使用 MVVMLight 和关注 this article 设置了我的 XF 应用程序。
我现在想介绍一个 XAML 启动页面,通过将其分配给 App.xaml.cs 中的 MainPage 属性在启动时加载它。加载后,在启动页面中,我想做一些异步任务来初始化应用程序,即从 API 获取初始数据等。完成后,我想导航到 MainTabbed 页面。
我还没有编写初始化逻辑,所以我正在使用 Thread.Sleep 来模拟这个。
我阅读了很多文章并尝试了几件事,但我陷入了以下任一问题:
- 启动页面加载但未导航到选项卡式页面。
- 启动页面根本不加载并导航到选项卡式页面 直接。
This article 是我遇到的最接近的,但我在释放信号量时似乎遇到了错误:
05-09 19:22:12.471 I/MonoDroid(14342): System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Threading.SemaphoreFullException: Adding the specified count to the semaphore would cause it to exceed its maximum count.
05-09 19:22:12.471 I/MonoDroid(14342): at System.Threading.SemaphoreSlim.Release (System.Int32 releaseCount) [0x0004c] in <fcbf47a04b2e4d90beafbae627e1fca4>:0
05-09 19:22:12.471 I/MonoDroid(14342): at System.Threading.SemaphoreSlim.Release () [0x00000] in <fcbf47a04b2e4d90beafbae627e1fca4>:0
感谢有关上述内容的任何建议,或者如何使用 xaml 实现启动页面(如果这在概念上有意义的话),因为大多数文章都在本地项目中使用本地实现或图像。
提前致谢。
【问题讨论】:
标签: xamarin.forms navigation mvvm-light splash-screen