如果有人从 http://myserver/folder/application.xbap 启动我的 xbap,我想获取 http://myserver/folder/ 部分来自应用程序中的 url。
我该怎么做?
我试过:
System.IO.Directory.GetCurrentDirectory()System.IO.Path.GetDirectoryName(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName)Environment.CurrentDirectorySystem.Reflection.Assembly.GetExecutingAssembly().LocationAppDomain.CurrentDomain.BaseDirectorySystem.Windows.Application.Current.StartupUri.AbsolutePathSystem.Environment.GetCommandLineArgs()[0]System.Deployment.Application.ApplicationDeployment.CurrentDeployment.DataDirectory
它们都返回 xbap 下载并运行的我机器上的本地位置,或者执行程序集的位置,例如 C:\Windows\SysWOW64
如何从应用程序本身访问用于启动 xbap 应用程序的 URL?
请您参考如下方法:
我相信是 BrowserInteropHelper.Source :
Gets the uniform resource identifier (URI) for the location from which a XAML browser application (XBAP) application was launched.
