private void OnJournalOwnershipPropertyChanged(JournalOwnership newValue) { // NavigationService.InvalidateJournalNavigationScope() will be called (recursively) // when making an ownership change and will throw if there is a navigation in progress. switch (_journalOwnership/*previous value*/) { case JournalOwnership.Automatic: switch (newValue) { case JournalOwnership.OwnsJournal: SwitchToOwnJournal(); break; case JournalOwnership.UsesParentJournal: SwitchToParentJournal(); break; } break; case JournalOwnership.OwnsJournal: Debug.Assert(_ownJournalScope != null); switch (newValue) { case JournalOwnership.Automatic: Debug.Fail("UsesOwnJournal->Automatic transition should be blocked by CoerceJournalOwnership()."); break; case JournalOwnership.UsesParentJournal: SwitchToParentJournal(); break; } break; case JournalOwnership.UsesParentJournal: Debug.Assert(_ownJournalScope == null); switch (newValue) { case JournalOwnership.Automatic: // The effective journal ownership is not going to change unless the // frame is reparented (or, more unlikely, the parent's journal becomes // unavailable). This invalidation is done only so that the next // navigation causes a switch to UsesParentJournal, to be consistent // with the initial transition from Automatic. _navigationService.InvalidateJournalNavigationScope(); break; case JournalOwnership.OwnsJournal: SwitchToOwnJournal(); break; } break; } _journalOwnership = newValue; }
public static T JournalOwnership <T>(this T source, JournalOwnership value) where T : Frame { source.JournalOwnership = value; return(source); }