コード例 #1
0
        /// <summary>
        /// Ensures current data about the current page is stored in the journal.
        /// This either updates an existing entry or adds a new one.
        /// </summary>
        /// <param name="journalEntry"></param>
        internal void UpdateCurrentEntry(JournalEntry journalEntry)
        {
            if (journalEntry == null)
            {
                throw new ArgumentNullException("journalEntry");
            }
            Debug.Assert(journalEntry.ContentId != 0);
            Debug.Assert(!(journalEntry.IsAlive() && journalEntry.JEGroupState.JournalDataStreams != null),
                         "Keep-alive content state should not be serialized.");

            if (_currentEntryIndex > -1 && _currentEntryIndex < TotalCount)
            {
                // update existing entry using the old entry's index.
                // Note: the new entry can be for a different NavigationService.
                JournalEntry oldEntry = _journalEntryList[_currentEntryIndex];
                journalEntry.Id = oldEntry.Id;
                _journalEntryList[_currentEntryIndex] = journalEntry;
            }
            else
            {
                // add new entry to the front
                journalEntry.Id = ++_journalEntryId;
                _journalEntryList.Add(journalEntry);
            }
            _version++;

            // If the next navigation is not #fragment or CustomContentState, this entry should be
            // remembered as the "exit" entry for the group, so when navigating back to the same
            // page, it will be shown. (It is not necessarily the last one in the group.)
            // Journal filtering will hide all other entries while at another page (different
            // NavigationService.Content object).
            journalEntry.JEGroupState.GroupExitEntry = journalEntry;
        }
コード例 #2
0
        // This is only called from ApplicationProxyInternal.GetSaveHistoryBytes when
        // we are persisting the entire journal; we only do that when we're quitting.
        // [new] Also when navigating a Frame that has its own journal.
        //


        internal void PruneKeepAliveEntries()
        {
            for (int i = TotalCount - 1; i >= 0; --i)
            {
                JournalEntry je = _journalEntryList[i];
                if (je.IsAlive())
                {
                    RemoveEntryInternal(i);
                }
                else
                {
                    Debug.Assert(je.GetType().IsSerializable);
                    // There can be keep-alive JEs creates for child frames.
                    DataStreams jds = je.JEGroupState.JournalDataStreams;
                    if (jds != null)
                    {
                        jds.PrepareForSerialization();
                    }

                    if (je.RootViewerState != null)
                    {
                        je.RootViewerState.PrepareForSerialization();
                    }
                }
            }
        }
コード例 #3
0
 // Token: 0x060028E1 RID: 10465 RVA: 0x000BD7C4 File Offset: 0x000BB9C4
 internal void PruneKeepAliveEntries()
 {
     for (int i = this.TotalCount - 1; i >= 0; i--)
     {
         JournalEntry journalEntry = this._journalEntryList[i];
         if (journalEntry.IsAlive())
         {
             this.RemoveEntryInternal(i);
         }
         else
         {
             DataStreams journalDataStreams = journalEntry.JEGroupState.JournalDataStreams;
             if (journalDataStreams != null)
             {
                 journalDataStreams.PrepareForSerialization();
             }
             if (journalEntry.RootViewerState != null)
             {
                 journalEntry.RootViewerState.PrepareForSerialization();
             }
         }
     }
 }
コード例 #4
0
ファイル: Journal.cs プロジェクト: sjyanxin/WPFSource
        /// <summary>
        /// Ensures current data about the current page is stored in the journal.
        /// This either updates an existing entry or adds a new one. 
        /// </summary>
        /// <param name="journalEntry"></param> 
        internal void UpdateCurrentEntry(JournalEntry journalEntry) 
        {
            if (journalEntry == null) 
            {
                throw new ArgumentNullException("journalEntry");
            }
            Debug.Assert(journalEntry.ContentId != 0); 
            Debug.Assert(!(journalEntry.IsAlive() && journalEntry.JEGroupState.JournalDataStreams != null),
                "Keep-alive content state should not be serialized."); 
 
            if (_currentEntryIndex > -1 && _currentEntryIndex < TotalCount)
            { 
                // update existing entry using the old entry's index.
                // Note: the new entry can be for a different NavigationService.
                JournalEntry oldEntry = _journalEntryList[_currentEntryIndex];
                journalEntry.Id = oldEntry.Id; 
                _journalEntryList[_currentEntryIndex] = journalEntry;
            } 
            else 
            {
                // add new entry to the front 
                journalEntry.Id = ++_journalEntryId;
                _journalEntryList.Add(journalEntry);
            }
            _version++; 

            // If the next navigation is not #fragment or CustomContentState, this entry should be 
            // remembered as the "exit" entry for the group, so when navigating back to the same 
            // page, it will be shown. (It is not necessarily the last one in the group.)
            // Journal filtering will hide all other entries while at another page (different 
            // NavigationService.Content object).
            journalEntry.JEGroupState.GroupExitEntry = journalEntry;
        }