public void LoadVisibleItems()
 {
     if (_isActive)
     {
         _handler.LoadVisibleItems(false);
     }
 }
Esempio n. 2
0
        private StickerSetPopup()
        {
            InitializeComponent();
            DataContext = TLContainer.Current.Resolve <StickerSetViewModel>();

            _handler = new AnimatedListHandler <Sticker>(List);
            _handler.DownloadFile = (id, sticker) =>
            {
                ViewModel.ProtoService.DownloadFile(id, 1);
            };

            _throttler          = new DispatcherTimer();
            _throttler.Interval = TimeSpan.FromMilliseconds(Constants.AnimatedThrottle);
            _throttler.Tick    += (s, args) =>
            {
                _throttler.Stop();
                _handler.LoadVisibleItems(false);
            };

            SecondaryButtonText = Strings.Resources.Close;
        }
Esempio n. 3
0
        public StickerDrawer()
        {
            InitializeComponent();

            ElementCompositionPreview.GetElementVisual(this).Clip = Window.Current.Compositor.CreateInsetClip();

            _handler = new AnimatedListHandler <StickerViewModel>(Stickers);
            _handler.DownloadFile = (id, sticker) =>
            {
                DownloadFile(_stickers, id, sticker);
            };

            _throttler          = new DispatcherTimer();
            _throttler.Interval = TimeSpan.FromMilliseconds(Constants.AnimatedThrottle);
            _throttler.Tick    += (s, args) =>
            {
                _throttler.Stop();
                _handler.LoadVisibleItems(false);
            };

            //_toolbarHandler = new AnimatedStickerHandler<StickerSetViewModel>(Toolbar);

            var shadow = DropShadowEx.Attach(Separator, 20, 0.25f);

            Separator.SizeChanged += (s, args) =>
            {
                shadow.Size = args.NewSize.ToVector2();
            };

            var observable = Observable.FromEventPattern <TextChangedEventArgs>(FieldStickers, "TextChanged");
            var throttled  = observable.Throttle(TimeSpan.FromMilliseconds(Constants.TypingTimeout)).ObserveOnDispatcher().Subscribe(async x =>
            {
                var items = ViewModel.SearchStickers;
                if (items != null && string.Equals(FieldStickers.Text, items.Query))
                {
                    await items.LoadMoreItemsAsync(1);
                    await items.LoadMoreItemsAsync(2);
                }
            });
        }