示例#1
0
        public StoryBoardItemViewModel Create()
        {
            StoryBoardItemViewModel item = new StoryBoardItemViewModel(this);

            //  Do :注册子项进度
            item.IndexChanged += l =>
            {
                //  Do :触发子项进度外部事件
                ItemIndexChanged?.Invoke(item, l);
            };

            this.Collection.Add(item);

            return(item);
        }
示例#2
0
        public void StartWith(StoryBoardItemViewModel item)
        {
            this.Stop();

            this.Collection.Foreach(l =>
            {
                if (l != item)
                {
                    l.PlayMode = false;
                }

                l.IsEnbled = l != item;
            });


            timer = new System.Timers.Timer();

            this.Value = MaxValue * item.LeftPercent;

            timer.Interval = Speed == 0 ? 1000 : 1010 - 125 * Speed;

            timer.Elapsed += (l, k) =>
            {
                timer.Interval = Speed == 0 ? 1000 : 1010 - 125 * Speed;



                if (this.Value < (int)MaxValue * item.RightPercent && this.Value >= MaxValue * item.LeftPercent)
                {
                    this.Value++;
                }
                else
                {
                    this.Value = MaxValue * item.LeftPercent;
                }


                IndexChanged?.Invoke(this.Value);
            };

            timer.Start();
        }