private object _RunDelegate(object args)
        {
            ApplicationProxyInternal.InitData initData = (ApplicationProxyInternal.InitData)args;
            Application application = Application.Current;

            if (application != null && !(application is XappLauncherApp))
            {
                string text = initData.Fragment;
                if (!string.IsNullOrEmpty(text) && application.StartupUri != null)
                {
                    Uri uri = application.StartupUri;
                    if (!application.StartupUri.IsAbsoluteUri)
                    {
                        uri = new Uri(BindUriHelper.BaseUri, application.StartupUri);
                    }
                    UriBuilder uriBuilder = new UriBuilder(uri);
                    if (text.StartsWith("#", StringComparison.Ordinal))
                    {
                        text = text.Substring("#".Length);
                    }
                    uriBuilder.Fragment    = text;
                    application.StartupUri = uriBuilder.Uri;
                }
                this.CreateRootBrowserWindow();
            }
            if (initData.UcomLoadIStream != null && initData.HandleHistoryLoad)
            {
                this.LoadHistoryStream(DocObjHost.ExtractComStream(initData.UcomLoadIStream), true);
            }
            return(null);
        }
Пример #2
0
        private object _RunDelegate(object args)
        {
            InitData initData = (InitData)args;

            Application currentApp = Application.Current;

            if (currentApp != null && !(currentApp is XappLauncherApp))
            {
                string fragment = initData.Fragment;
                if (!String.IsNullOrEmpty(fragment) && currentApp.StartupUri != null)
                {
                    // Apply Fragment to Application StartupUri.
                    UriBuilder uriBuilder;
                    Uri        absUri = currentApp.StartupUri;

                    if (currentApp.StartupUri.IsAbsoluteUri == false)
                    {
                        absUri = new Uri(BindUriHelper.BaseUri, currentApp.StartupUri);
                    }

                    uriBuilder = new UriBuilder(absUri);
                    if (fragment.StartsWith(FRAGMENT_MARKER, StringComparison.Ordinal))
                    {
                        fragment = fragment.Substring(FRAGMENT_MARKER.Length);
                    }
                    uriBuilder.Fragment   = fragment;
                    currentApp.StartupUri = uriBuilder.Uri;
                }

                CreateRootBrowserWindow();
            }

            //If we were started through IPersistHistory::Load, load from the history stream instead
            //of navigating to the StartupPage
            if (initData.UcomLoadIStream != null && initData.HandleHistoryLoad)
            {
                LoadHistoryStream(DocObjHost.ExtractComStream(initData.UcomLoadIStream), /*firstHistoryLoad=s*/ true);
            }
            return(null);
        }