コード例 #1
0
        private bool IsNameMatch(object item)
        {
            ListBoxItem    lbi = item as ListBoxItem;
            AnimationEntry i   = lbi.Content as AnimationEntry;

            return(-1 != i.AnimationName.IndexOf(_animationHeader.filter.Text, StringComparison.CurrentCultureIgnoreCase));
        }
コード例 #2
0
 //更新动画名字框宽度
 void _animationHeader_FilterWidthChanged(object sender, double newWidth)
 {
     for (int i = 0; i < _animationList.Items.Count; ++i)
     {
         ListBoxItem    lbi   = _animationList.Items[i] as ListBoxItem;
         AnimationEntry entry = lbi.Content as AnimationEntry;
         entry.Column0Width = newWidth;
     }
 }
コード例 #3
0
 //滚动
 void _scrollbar_Scroll(object sender, ScrollEventArgs e)
 {
     _animationHeader.ScrollPosition = e.NewValue;
     for (int i = 0; i < _animationList.Items.Count; ++i)
     {
         ListBoxItem    lbi   = _animationList.Items[i] as ListBoxItem;
         AnimationEntry entry = lbi.Content as AnimationEntry;
         entry.ScrollPosition = e.NewValue;
     }
 }
コード例 #4
0
        public int GetCurrentAnimationIndex()
        {
            ListBoxItem lbi = _animationList.SelectedItem as ListBoxItem;

            if (lbi == null)
            {
                return(-1);
            }

            AnimationEntry entry = lbi.Content as AnimationEntry;

            return((int)entry.AnimationIndex);
        }
コード例 #5
0
 public void SelectAnimation(int animIndex, bool loop)
 {
     foreach (ListBoxItem lbi in _animationList.Items)
     {
         AnimationEntry entry = lbi.Content as AnimationEntry;
         if (entry.AnimationIndex == animIndex)
         {
             _animationToolbar.Loop      = loop;
             _animationList.SelectedItem = lbi;
             _animationList.ScrollIntoView(lbi);
             break;
         }
     }
 }
コード例 #6
0
        //在动画加载后调用, 取动画长度的最大值
        public void RecalculateScrollWidth()
        {
            double m = 0;

            for (int i = 0; i < _animationList.Items.Count; ++i)
            {
                ListBoxItem    lbi   = _animationList.Items[i] as ListBoxItem;
                AnimationEntry entry = lbi.Content as AnimationEntry;
                if (m < entry.MinColumn1Width)
                {
                    m = entry.MinColumn1Width;
                }
            }

            _animationHeader._timelineColumn.MinWidth = m;
            _scrollbar.Maximum = m;
        }
コード例 #7
0
        public void UpdateProgress(int animIndex, float currentFrame)
        {
            _animationHeader.UpdateProgressIndicator(currentFrame);

            foreach (ListBoxItem lbi in _animationList.Items)
            {
                AnimationEntry entry = lbi.Content as AnimationEntry;
                if (entry.AnimationIndex == animIndex)
                {
                    entry.UpdateProgressIndicator(currentFrame);
                }
                else
                {
                    entry.UpdateProgressIndicator(0);
                }
            }
        }
コード例 #8
0
        public void AddAnimation(string animName, uint animLength, uint animIndex)
        {
            ListBoxItem lbi = new ListBoxItem();

            AnimationEntry entry = new AnimationEntry()
            {
                Column0Width    = _animationHeader.FilterWidth,
                AnimationIndex  = animIndex,
                AnimationLength = animLength
            };

            entry.Register(lbi, _animationHeader);
            lbi.Content = entry;

            entry.AnimationName = animName;

            _animationList.Items.Add(lbi);
        }