Exemple #1
0
        private void _OnBPReady(Object o, BPReadyEventArgs e)
        {
            // update content property
            SetCurrentValueInternal(ContentProperty, e.Content);

            // Need to refresh everytime the child changed
            InvalidateMeasure();

            // We post a dispatcher work item to fire ContentRendered
            // only if this is Loaded in the tree.  If not, we will
            // post it from the LoadedHandler.  This guarantees that
            // we don't fire ContentRendered on a subtree that is not
            // connected to a PresentationSource
            if (IsLoaded == true)
            {
                PostContentRendered();
            }
            else
            {
                // _postContentRenderedFromLoadedHandler == true means
                // that we deferred to the Loaded event to PostConetentRendered
                // for the previous content change and Loaded has not fired yet.
                // Thus we don't want to hook up another event handler
                if (_postContentRenderedFromLoadedHandler == false)
                {
                    this.Loaded += new RoutedEventHandler(LoadedHandler);
                    _postContentRenderedFromLoadedHandler = true;
                }
            }
        }
Exemple #2
0
 private void OnBPReady(Object sender, BPReadyEventArgs e)
 {
     // set Window.ContentProperty
     Content = e.Content;
 }
Exemple #3
0
 private void OnBPReady(Object sender, BPReadyEventArgs e)
 {
     // set Window.ContentProperty
     Content = e.Content;
 }
Exemple #4
0
        private void OnPreBPReady(object sender, BPReadyEventArgs e)
        {
            NavService.PreBPReady -= new BPReadyEventHandler(OnPreBPReady);
            NavService.AllowWindowNavigation = false;

            ConfigAppWindowAndRootElement(e.Content, e.Uri);

            NavService = null;
            e.Cancel = true;
        }
Exemple #5
0
        /// <summary>
        /// The callback that happens when the bind product corresponding to a
        /// URI has been created.
        /// </summary>
        /// <param name="contentType">MIME type from which product was created</param>
        /// <param name="bp">Content created.</param>
        /// <param name="bpu">Absolute URI of content, or null</param>
        /// <param name="navState"></param>
        void IContentContainer.OnContentReady(ContentType contentType, Object bp, Uri bpu, Object navState)
        {
            Invariant.Assert(bpu == null || bpu.IsAbsoluteUri, "Content URI must be absolute.");
            if (IsDisposed)
            {
                return;
            }

            // If an invalid root element is passed to Navigation Service, throw exception here.
            if (IsValidRootElement(bp) == false)
            {
                throw new InvalidOperationException(SR.Get(SRID.WrongNavigateRootElement, bp.ToString()));
            }

            /*

*/

            ResetPendingNavigationState(NavigationStatus.Navigated);

            NavigateInfo navInfo = navState as NavigateInfo;
            NavigationMode navMode = navInfo == null ? NavigationMode.New : navInfo.NavigationMode;

            Debug.Assert(bpu == null ||
                         navInfo == null ||
                         navInfo.Source == null ||
                         IsSameUri(null, navInfo.Source, bpu, false /* withFragment */),
                         "Source in OnContentReady does not match source in NavigateInfo");
            if (bpu == null)
            {
                bpu = (navInfo == null) ? null : navInfo.Source;
            }

            Uri bpuClean = BindUriHelper.GetUriRelativeToPackAppBase(bpu);

            // This gives the Application a chance to see if this bind needs an AppWindow.
            // This will happen if this is the first tree we're loading and it doesn't
            // have a toplevel Window element.
            if (PreBPReady != null)
            {
                // ok to pass resolved Uri here because this is internal
                BPReadyEventArgs args = new BPReadyEventArgs(bp, bpu);
                PreBPReady(this, args);
                if (args.Cancel)
                {
                    _navStatus = NavigationStatus.Idle;
                    return;
                }
            }

            bool objectRefresh = false;
            if (object.ReferenceEquals(bp, _bp))
            {
                Debug.Assert(navMode == NavigationMode.Refresh,
                    "OnContentReady() should not be called with the same object except for Refresh.");
                objectRefresh = true;
                // Note: The converse is not true: When refreshing from a URI, bp will be a different object.

                // To force full refresh, the Content object is detached from the tree and reattached.
                // (Just invalidating layout would not cause ContentRendered to be raised.)
                _bp = null;
                if (BPReady != null)
                {
                    BPReady(this, new BPReadyEventArgs(null, null));
                }
            }
            else
            {
                // send resolved Uri here because OnBeforeSwitchContent sets it as the new base uri
                if (!OnBeforeSwitchContent(bp, navInfo, bpu))
                {
                    Debug.Assert(!JournalScope.Journal.HasUncommittedNavigation);
                    return;
                }

                // On Refresh, keep the current ContentId. On journal navigation, restore it from the
                // journal entry instead of assigning a new one. This will ensure that fragment navigation
                // to other entries associated with the same content will still work properly.
                // (See Navigate(Uri, object).)
                if (navMode != NavigationMode.Refresh)
                {
                    if (navInfo == null || navInfo.JournalEntry == null) // new navigation?
                    {
                        _contentId++; // Note: this is done even when bp==null.
                        _journalEntryGroupState = null; // start anew
                    }
                    else
                    {
                        Debug.Assert(navMode == NavigationMode.Back || navMode == NavigationMode.Forward);

                        _contentId = navInfo.JournalEntry.ContentId;
                        Debug.Assert(_contentId != 0);

                        // The JournalEntryGroupState object from the JE must be reused because other JEs
                        // may have references to it.
                        Debug.Assert(_journalEntryGroupState == null ||
                            _journalEntryGroupState.ContentId != _contentId); // because _bp != bp
                        _journalEntryGroupState = navInfo.JournalEntry.JEGroupState;
                    }

                    // Set the source to the original source
                    _currentSource = bpu;
                    _currentCleanSource = bpuClean;
                }
            }

            _bp = bp;
            if (BPReady != null)
            {
                BPReady(this, new BPReadyEventArgs(_bp, bpu));
            }

            // This will fire Navigated event and LoadCompleted event if all sub-loads are done
            HandleNavigated(navState, !objectRefresh/*navigatedToNewContent*/);
        }
Exemple #6
0
 // Token: 0x06002A4B RID: 10827 RVA: 0x000C23F1 File Offset: 0x000C05F1
 private void OnBPReady(object sender, BPReadyEventArgs e)
 {
     base.Content = e.Content;
 }