Example #1
0
 protected override void OnDispose()
 {
     if (IncrementalLoadingItems.Source is HohoemaIncrementalSourceBase <ITEM_VM> )
     {
         (IncrementalLoadingItems.Source as HohoemaIncrementalSourceBase <ITEM_VM>).Error -= HohoemaIncrementalSource_Error;
     }
     IncrementalLoadingItems?.Dispose();
 }
 protected override void OnDispose()
 {
     if (IncrementalLoadingItems != null)
     {
         IncrementalLoadingItems.BeginLoading -= BeginLoadingItems;
         IncrementalLoadingItems.DoneLoading  -= CompleteLoadingItems;
         if (IncrementalLoadingItems.Source is HohoemaIncrementalSourceBase <ITEM_VM> )
         {
             (IncrementalLoadingItems.Source as HohoemaIncrementalSourceBase <ITEM_VM>).Error -= HohoemaIncrementalSource_Error;
         }
         IncrementalLoadingItems.Dispose();
         IncrementalLoadingItems = null;
     }
 }
Example #3
0
        protected async Task ResetList()
        {
            HasItem.Value          = true;
            LoadedItemsCount.Value = 0;

            IsSelectionModeEnable.Value = false;

            SelectedItems.Clear();

            if (IncrementalLoadingItems != null)
            {
                if (IncrementalLoadingItems.Source is HohoemaIncrementalSourceBase <ITEM_VM> )
                {
                    (IncrementalLoadingItems.Source as HohoemaIncrementalSourceBase <ITEM_VM>).Error -= HohoemaIncrementalSource_Error;
                }
                IncrementalLoadingItems.BeginLoading -= BeginLoadingItems;
                IncrementalLoadingItems.DoneLoading  -= CompleteLoadingItems;
                IncrementalLoadingItems.Dispose();
                IncrementalLoadingItems = null;
            }

            try
            {
                var source = GenerateIncrementalSource();

                MaxItemsCount.Value = await source.ResetSource();

                IncrementalLoadingItems = new IncrementalLoadingCollection <IIncrementalSource <ITEM_VM>, ITEM_VM>(source);
                OnPropertyChanged(nameof(IncrementalLoadingItems));

                IncrementalLoadingItems.BeginLoading += BeginLoadingItems;
                IncrementalLoadingItems.DoneLoading  += CompleteLoadingItems;

                if (IncrementalLoadingItems.Source is HohoemaIncrementalSourceBase <ITEM_VM> )
                {
                    (IncrementalLoadingItems.Source as HohoemaIncrementalSourceBase <ITEM_VM>).Error += HohoemaIncrementalSource_Error;
                }

                PostResetList();
            }
            catch
            {
                IncrementalLoadingItems = null;
                NowLoadingItems.Value   = false;
                HasItem.Value           = true;
                HasError.Value          = true;
                Debug.WriteLine("failed GenerateIncrementalSource.");
            }
        }