コード例 #1
0
        private static IEnumerable <Change> GetAppChanges(ValueChange <AppToken> diff)
        {
            var ids = new ChangeSet <AppId, AppToken, BookId, BookToken>(diff, diff.Select(app => app.Books));

            var result = Enumerable.Empty <Change>();

            if (diff.IsChanged(app => app.IsVisible))
            {
                var newValue = diff.NewValue.IsVisible;
                result = result.Concat(Change.SetVisibility(diff.NewValue.Id, newValue));
                if (!newValue)
                {
                    return(result);           //Don't look for other changes if the app just went invisible.
                }
            }

            if (diff.IsChanged(app => app.IsActive))
            {
                result = result.Concat(Change.SetActive(diff.NewValue.Id, diff.NewValue.IsActive));
            }

            result = result.Concat(ids.RemovedChanges)
                     .Concat(ids.AddedChanges)
                     .Concat(ids.NestedChanges(GetBookChanges));

            return(result);
        }
コード例 #2
0
        private static IEnumerable <Change> GetSheetCollectionChanges(ValueChange <BookToken> diff)
        {
            var ids = new ChangeSet <BookId, BookToken, SheetId, SheetToken>(diff, diff.Select(book => book.Sheets));

            return(ids.RemovedChanges
                   .Concat(ids.AddedChanges)
                   .Concat(ids.NestedChanges(GetSheetChanges)));
        }
コード例 #3
0
        private static IEnumerable <Change> GetSessionChanges(ValueChange <SessionToken> diff)
        {
            var ids = new ChangeSet <SessionId, SessionToken, AppId, AppToken>(diff, diff.Select(session => session.Apps));

            return(ids.RemovedChanges
                   .Concat(ids.AddedChanges)
                   .Concat(ids.NestedChanges(GetAppChanges)));
        }