我正在尝试为 UWP 应用程序使用执行别名,但是当我运行它时
该应用程序卡在此屏幕上:
在 Package.appxmanifest 文件中,我有:
<Applications>
<Application Id="App"
Executable="$targetnametoken$.exe"
EntryPoint="UWPApp4.App"
>
<uap:VisualElements
DisplayName="UWPApp4"
Square150x150Logo="Assets\Square150x150Logo.png"
Square44x44Logo="Assets\Square44x44Logo.png"
Description="UWPApp4"
BackgroundColor="transparent">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png"/>
<uap:SplashScreen Image="Assets\SplashScreen.png" />
</uap:VisualElements>
<Extensions>
<uap5:Extension Category="windows.appExecutionAlias">
<uap5:AppExecutionAlias>
<uap5:ExecutionAlias Alias="MyApp1234.exe" />
</uap5:AppExecutionAlias>
</uap5:Extension>
</Extensions>
</Application>
</Applications>
ZIP 文件中的项目:https : //drive.google.com/open?id=1YKp2SevzkoPWulN2VrueYe17H7DF1sdy
您需要在 App.xaml.cs 中处理 OnActivated 以处理传入参数并创建并导航到您的主窗口。如果需要,您可以重用或重构现有 OnLaunched 方法中的大部分代码以创建新的根框架并将其导航到 MainPage。
IActivatedEventArgs.Kind 将是ActivationKind .CommandLineLaunch 并且 IActivatedEventArgs 将是CommandLineActivatedEventArgs
有关详细信息,请参阅通用 Windows 应用程序的命令行激活。
要调试它,请打开您的项目属性,转到调试选项卡,然后检查启动操作:不要启动,但在启动时调试我的代码。在 OnActivated 方法上设置断点,从命令行启动应用程序,它应该在 OnActivated 方法中中断
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句