private void LoadState(object node)
		{
			UIElement uielement = node as UIElement;
			if (uielement == null)
			{
				return;
			}
			int persistId = uielement.PersistId;
			if (persistId != 0)
			{
				if (this.HasSubStreams(persistId))
				{
					ArrayList subStreams = this.GetSubStreams(persistId);
					this.LoadSubStreams(uielement, subStreams);
				}
				if (this._customJournaledObjects != null && this._customJournaledObjects.Contains(persistId))
				{
					CustomJournalStateInternal state = (CustomJournalStateInternal)this._customJournaledObjects[persistId];
					IJournalState journalState = node as IJournalState;
					if (journalState != null)
					{
						journalState.RestoreJournalState(state);
					}
				}
			}
		}
Exemplo n.º 2
0
        private void LoadState(object node)
        {
            UIElement element = node as UIElement;

            if (element == null)
            {
                return;
            }

#pragma warning disable 618
            int persistId = element.PersistId;
#pragma warning restore 618

            // Due to
            if (persistId != 0)
            {
                if (this.HasSubStreams(persistId))
                {
                    // Get the properties to restore
                    ArrayList properties = this.GetSubStreams(persistId);
                    LoadSubStreams(element, properties);
                }

                if (_customJournaledObjects != null && _customJournaledObjects.Contains(persistId))
                {
                    CustomJournalStateInternal state =
                        (CustomJournalStateInternal)_customJournaledObjects[persistId];
                    Debug.Assert(state != null);
                    IJournalState customJournalingObject = node as IJournalState;

                    //
                    // For below two scenarios, JournalData cannot be restored successfully. For now, we just
                    // simply ignore it and don't throw exception.
                    //
                    //  A. After the tree was created from xaml/baml stream,  some elements might be replaced
                    //     programatically with new elements which could be created from other xaml/baml by Parser.
                    //
                    //  B. If the loose xaml file has been changed since the journal data was created
                    //
                    //

                    if (customJournalingObject != null)
                    {
                        customJournalingObject.RestoreJournalState(state);
                    }
                }
            }
        }