コード例 #1
0
        // Ctors
        /////////////////////////////////////////////////////////////////////

        #region Ctors

        internal JournalEntryPageFunctionType(JournalEntryGroupState jeGroupState, PageFunctionBase pageFunction)
            : base(jeGroupState, pageFunction)
        {
            string typeName = pageFunction.GetType().AssemblyQualifiedName;

            this._typeName = new SecurityCriticalDataForSet <string>(typeName);
        }
コード例 #2
0
        // Ctors
        /////////////////////////////////////////////////////////////////////

        #region Ctors

        internal JournalEntryPageFunctionKeepAlive(JournalEntryGroupState jeGroupState, PageFunctionBase pageFunction)
            : base(jeGroupState, pageFunction)
        {
            Debug.Assert(pageFunction != null && pageFunction.KeepAlive);
            this._keepAlivePageFunction = pageFunction;
        }
コード例 #3
0
        // Ctors
        /////////////////////////////////////////////////////////////////////

        #region Ctors

        //
        // Ctor of JournalEntryPageFunctionSaver
        //
        internal JournalEntryPageFunctionSaver(JournalEntryGroupState jeGroupState, PageFunctionBase pageFunction)
            : base(jeGroupState, pageFunction)
        {
            Debug.Assert(!pageFunction.KeepAlive);
        }
コード例 #4
0
        // Ctors
        /////////////////////////////////////////////////////////////////////

        #region Ctors

        internal JournalEntryKeepAlive(JournalEntryGroupState jeGroupState, Uri uri, object keepAliveRoot)
            : base(jeGroupState, uri)
        {
            Invariant.Assert(keepAliveRoot != null);
            _keepAliveRoot = keepAliveRoot;
        }
コード例 #5
0
        // Ctors
        /////////////////////////////////////////////////////////////////////

        #region Ctors

        internal JournalEntryPageFunction(JournalEntryGroupState jeGroupState, PageFunctionBase pageFunction)
            : base(jeGroupState, null)
        {
            PageFunctionId       = pageFunction.PageFunctionId;
            ParentPageFunctionId = pageFunction.ParentPageFunctionId;
        }
コード例 #6
0
ファイル: NavigationService.cs プロジェクト: JianwenSun/cc
        /// <summary>
        /// Makes the appropriate kind of journal entry for the current Content and its state.
        /// For certain types of content, no journal entry is created (null is returned).
        /// </summary>
        internal JournalEntry MakeJournalEntry(JournalReason journalReason)
        {
            if (_bp == null)
            {
                return null;
            }

            Debug.Assert(_contentId != 0 &&
                (_journalEntryGroupState == null || _journalEntryGroupState.ContentId == _contentId));
            if (_journalEntryGroupState == null) // First journal entry created for the current Content?
            {
                _journalEntryGroupState = new JournalEntryGroupState(_guidId, _contentId);
            }

            JournalEntry journalEntry;
            bool keepAlive = IsContentKeepAlive();
            PageFunctionBase pfBase = _bp as PageFunctionBase;
            if (pfBase != null)
            {
                if (keepAlive)
                {
                    journalEntry = new JournalEntryPageFunctionKeepAlive(_journalEntryGroupState, pfBase);
                }
                else
                {
                    //
                    // If the PageFunction is navigated from xaml Uri, or navigated from an instance of
                    // PageFunction type, but that PageFunctin type is implemented from xaml file,
                    // we should always get the BaseUri DP value for the root PageFunction element.
                    //
                    // If the code navigates to pure #fragment, the root element should be ready,
                    // if the BaseUri for that root element is set, we should still use JournalEntryPageFunctionUri.
                    // if the BaseUri for that root element is not set, that pagefunction class is not
                    // implemented in xaml file, JournalEntryPageFunctionType is used for journaling.
                    // Navigation service has its own way to get to the element marked by the pure fragment.
                    //
                    Uri baseUri = pfBase.GetValue(BaseUriHelper.BaseUriProperty) as Uri;

                    if (baseUri != null)
                    {
                        Invariant.Assert(baseUri.IsAbsoluteUri == true, "BaseUri for root element should be absolute.");

                        Uri markupUri;

                        //
                        // Set correct uri when creating instance of JournalEntryPageFunctionUri
                        //
                        //   This markupUri is used to create instance of PageFunction from baml stream.
                        //   fragment in original Source doesn't affect the resource loading, and it will
                        //   be set in the JournalEntry.Source for further navigation handling. So the logic
                        //   of setting markupUri for JEPFUri can be simplified as below:
                        //
                        //   If _currentCleanSource is set and it is not a pure fragment uri, take whatever
                        //   value of _currentSource, which should always be an absolute Uri for the page.
                        //
                        //   For all other cases, take whatever value of BaseUri in root element.
                        //
                        if (_currentCleanSource != null && BindUriHelper.StartWithFragment(_currentCleanSource) == false )
                        {
                            markupUri = _currentSource;
                        }
                        else
                        {
                            markupUri = baseUri;
                        }

                        journalEntry = new JournalEntryPageFunctionUri(_journalEntryGroupState, pfBase, markupUri);
                    }
                    else
                    {
                        journalEntry = new JournalEntryPageFunctionType(_journalEntryGroupState, pfBase);
                    }
                }

                journalEntry.Source = _currentCleanSource; // This could be #fragment.
            }
            else
            {
                if (keepAlive)
                {
                    journalEntry = new JournalEntryKeepAlive(_journalEntryGroupState, _currentCleanSource, _bp);
                }
                else
                {
                    journalEntry = new JournalEntryUri(_journalEntryGroupState, _currentCleanSource);
                }
            }

            // _customContentStateToSave can be preset by AddBackEntry() or FireNavigating().
            // If not, try the IProvideCustomContentState callback.
            CustomContentState ccs = _customContentStateToSave;
            if (ccs == null)
            {
                IProvideCustomContentState pccs = _bp as IProvideCustomContentState;
                if (pccs != null)
                {
                    ccs = pccs.GetContentState();
                }
            }
            if (ccs != null)
            {
                // Make sure the object is serializable
                Type type = ccs.GetType();
                if (!type.IsSerializable)
                {
                    throw new SystemException(SR.Get(SRID.CustomContentStateMustBeSerializable, type));
                }
                journalEntry.CustomContentState = ccs;
            }
            // Info: CustomContentState for the current page in child frames is saved in
            // DataStreams.SaveState(). (This requires the IProvideCustomContentState to be implemented.)

            // Root Viewer journaling
            if (_rootViewerStateToSave != null) // state saved in advance?
            {
                journalEntry.RootViewerState = _rootViewerStateToSave;
                _rootViewerStateToSave = null;
            }
            else
            {
                journalEntry.RootViewerState = GetRootViewerState(journalReason);
            }

            // Set the friendly Name of this JournalEntry, it will be used to display
            // in the drop-down list on the Back/Forward buttons
            // Journal entries aren't recycled when going back\forward. A new JournalEntry is always created, so
            // we need to set the name each time
            // 

            string name = null;
            if (journalEntry.CustomContentState != null)
            {
                name = journalEntry.CustomContentState.JournalEntryName;
            }
            if (string.IsNullOrEmpty(name))
            {
                DependencyObject dependencyObject = _bp as DependencyObject;
                if (dependencyObject != null)
                {
                    name = (string)dependencyObject.GetValue(JournalEntry.NameProperty);

                    if (String.IsNullOrEmpty(name) && dependencyObject is Page)
                    {
                        name = (dependencyObject as Page).Title;
                    }
                }
                if (!String.IsNullOrEmpty(name))
                {
                    if (_currentSource != null)
                    {
                        string fragment = BindUriHelper.GetFragment(_currentSource);
                        if (!string.IsNullOrEmpty(fragment))
                        {
                            name = name + "#" + fragment;
                        }
                    }
                }
                else
                {
                    // Page.WindowTitle is just a shortcut to Window.Title.
                    // The window title is used as a journal entry name only for a top-level container.
                    NavigationWindow navWin =
                        JournalScope == null ? null : JournalScope.NavigatorHost as NavigationWindow;
                    if (navWin != null && this == navWin.NavigationService
                        && !String.IsNullOrEmpty(navWin.Title))
                    {
                        if (CurrentSource != null)
                        {
                            name = String.Format(CultureInfo.CurrentCulture, "{0} ({1})", navWin.Title, JournalEntry.GetDisplayName(_currentSource, SiteOfOriginContainer.SiteOfOrigin));
                        }
                        else
                        {
                            name = navWin.Title;
                        }
                    }
                    else
                    {
                        // if not title was set we use the uri if it is available.
                        if (CurrentSource != null)
                        {
                            name = JournalEntry.GetDisplayName(_currentSource, SiteOfOriginContainer.SiteOfOrigin);
                        }
                        else
                        {
                            name = SR.Get(SRID.Untitled);
                        }
                    }
                }
            }
            journalEntry.Name = name;

            if (journalReason == JournalReason.NewContentNavigation)
            {
                journalEntry.SaveState(_bp);
            }

            return journalEntry;
        }
コード例 #7
0
        // Ctors
        /////////////////////////////////////////////////////////////////////

        #region Ctors

        internal JournalEntryUri(JournalEntryGroupState jeGroupState, Uri uri)
            : base(jeGroupState, uri)
        {
        }
コード例 #8
0
 internal JournalEntryPageFunctionType(JournalEntryGroupState jeGroupState, PageFunctionBase pageFunction)
     : base(jeGroupState, pageFunction)
 {
     string typeName = pageFunction.GetType().AssemblyQualifiedName;
     this._typeName = new SecurityCriticalDataForSet<string>(typeName);
 }
コード例 #9
0
        // Ctors
        /////////////////////////////////////////////////////////////////////

        #region Ctors

        internal JournalEntryPageFunctionUri(JournalEntryGroupState jeGroupState, PageFunctionBase pageFunction, Uri markupUri)
            : base(jeGroupState, pageFunction)
        {
            _markupUri = markupUri;
        }
コード例 #10
0
        // Ctors
        /////////////////////////////////////////////////////////////////////

        #region Ctors

        internal JournalEntryPageFunctionKeepAlive(JournalEntryGroupState jeGroupState, PageFunctionBase pageFunction)
            : base(jeGroupState, pageFunction)
        {
            Debug.Assert(pageFunction != null && pageFunction.KeepAlive);
            this._keepAlivePageFunction = pageFunction;
        }
コード例 #11
0
        // Ctors
        /////////////////////////////////////////////////////////////////////

        #region Ctors

        //
        // Ctor of JournalEntryPageFunctionSaver
        //
        internal JournalEntryPageFunctionSaver(JournalEntryGroupState jeGroupState, PageFunctionBase pageFunction)
            : base(jeGroupState, pageFunction)
        {
            Debug.Assert(!pageFunction.KeepAlive);
        }
コード例 #12
0
        // Ctors
        /////////////////////////////////////////////////////////////////////

        #region Ctors

        internal JournalEntryPageFunction(JournalEntryGroupState jeGroupState, PageFunctionBase pageFunction)
            : base(jeGroupState, null)
        {
            PageFunctionId = pageFunction.PageFunctionId;
            ParentPageFunctionId = pageFunction.ParentPageFunctionId;
        }
コード例 #13
0
        // Ctors
        /////////////////////////////////////////////////////////////////////

        #region Ctors

        internal JournalEntryKeepAlive(JournalEntryGroupState jeGroupState, Uri uri, object keepAliveRoot)
            : base(jeGroupState, uri)
        {
            Invariant.Assert(keepAliveRoot != null);
            _keepAliveRoot = keepAliveRoot;
        }
コード例 #14
0
        // Ctors
        /////////////////////////////////////////////////////////////////////

        #region Ctors

        internal JournalEntryUri(JournalEntryGroupState jeGroupState, Uri uri)
            : base(jeGroupState, uri)
        {
        }
コード例 #15
0
        // Ctors
        /////////////////////////////////////////////////////////////////////

        #region Ctors

        internal JournalEntryPageFunctionUri(JournalEntryGroupState jeGroupState, PageFunctionBase pageFunction, Uri markupUri)
            : base(jeGroupState, pageFunction)
        {
            _markupUri = markupUri;
        }
コード例 #16
0
 // Token: 0x06007962 RID: 31074 RVA: 0x002270FA File Offset: 0x002252FA
 internal JournalEntryPageFunctionKeepAlive(JournalEntryGroupState jeGroupState, PageFunctionBase pageFunction) : base(jeGroupState, pageFunction)
 {
     this._keepAlivePageFunction = pageFunction;
 }
コード例 #17
0
ファイル: JournalEntry.cs プロジェクト: sjyanxin/WPFSource
        // Ctors
        /////////////////////////////////////////////////////////////////////
 
        #region Ctors
 
        internal JournalEntry(JournalEntryGroupState jeGroupState, Uri uri) 
        {
            _jeGroupState = jeGroupState; 
            if (jeGroupState != null)
            {
                // Seems convenient to always do this here.
                jeGroupState.GroupExitEntry = this; 
            }
            Source = uri; 
        } 
 // Token: 0x06007969 RID: 31081 RVA: 0x0022718A File Offset: 0x0022538A
 internal JournalEntryPageFunctionSaver(JournalEntryGroupState jeGroupState, PageFunctionBase pageFunction) : base(jeGroupState, pageFunction)
 {
 }