예제 #1
0
        public static GalleryVM GetVM(Gallery gallery)
        {
            var gi = new GalleryInfo(gallery.ID, gallery.Token);

            if (Cache.TryGet(gi, out var vm))
            {
                vm.Gallery = gallery;
                if (gallery.Count <= vm.currentIndex)
                {
                    vm.currentIndex = -1;
                }
            }
            else
            {
                vm = new GalleryVM(gallery);
                Cache.Add(gi, vm);
            }
            return(vm);
        }