如果有人从 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.CurrentDirectory
System.Reflection.Assembly.GetExecutingAssembly().Location
AppDomain.CurrentDomain.BaseDirectory
System.Windows.Application.Current.StartupUri.AbsolutePath
System.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.
关于c# - 如何获取用于启动 XBAP 的 URL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13708594/