示例#1
0
        private int Activate(int index, string transition = " transition: -webkit-transform 500ms ease 0s;")
        {
            if (Effect == CarouselEffect.ScrollX)
            {
                _trackStyle = $"width: {_totalWidth}px; opacity: 1; transform: translate3d(-{_slickWidth * (index + 1)}px, 0px, 0px);{transition}";
            }

            if (index == _slicks.Count)
            {
                index = 0;
            }

            CarouselSlick slick = _slicks[index];

            _slicks.ForEach(s =>
            {
                if (s == slick)
                {
                    _activeSlick = s;
                    s.Activate();
                }
                else
                {
                    s.Deactivate();
                }
            });

            return(index);
        }
示例#2
0
 internal void AddSlick(CarouselSlick slick)
 {
     _slicks.Add(slick);
     if (_activeSlick == null)
     {
         Activate(0);
     }
 }
示例#3
0
        internal void RemoveSlick(CarouselSlick slick)
        {
            var slicks = new List <CarouselSlick>(_slicks ?? new List <CarouselSlick>());

            slicks.Remove(slick);
            _slicks = slicks;
            InvokeAsync(async() =>
            {
                await InvokeAsync(StateHasChanged).ConfigureAwait(false);
            });
        }
示例#4
0
        internal void AddSlick(CarouselSlick slick)
        {
            var slicks = new List <CarouselSlick>(_slicks ?? new List <CarouselSlick>());

            slicks.Add(slick);
            _slicks = slicks;
            if (ActiveSlick == null)
            {
                Activate(_slicks[0]);
            }
            InvokeStateHasChanged();
        }
示例#5
0
 private void Activate(CarouselSlick slick)
 {
     this.ActiveSlick = slick;
 }
示例#6
0
 internal int IndexOfSlick(CarouselSlick slick)
 {
     return(_slicks.IndexOf(slick));
 }
示例#7
0
 internal void RemoveSlick(CarouselSlick slick)
 {
     _slicks.Remove(slick);
 }