Пример #1
0
        /// <summary>
        /// This produces effectively the same display and automatic updating as AddObjSeq, but instead of immediately
        /// building the display, it creates a LazyBox and LazyHookup which between them manage the process of
        /// building the item displays only when they are needed.
        /// </summary>
        private ViewBuilder AddLazyObjSeq <T>(object target, Func <IEnumerable <T> > fetcher, Action <IReceivePropChanged> hookEventAction,
                                              Action <IReceivePropChanged> unhookEventAction, Action <ViewBuilder, T> displayOneT, int tag) where T : class
        {
            var hookup = new LazyHookup <T>(target, m_destination, fetcher, hookEventAction, unhookEventAction,
                                            displayOneT);

            CurrentHookup = hookup;
            hookup.Tag    = tag;
            var currentTs = fetcher();

            if (currentTs.FirstOrDefault() == null)
            {
                return(this);                // no need to insert anything, currently no items.
            }
            InsertBox(new LazyBox <T>(NestedBoxStyles, hookup, fetcher()));
            return(this);
        }
Пример #2
0
 public LazyBox(AssembledStyles style, LazyHookup <T> hookup, IEnumerable <T> items) : base(style)
 {
     m_hookup = hookup;
     m_items  = new List <T>(items);
 }