public ReplicateSlidePatternOperation( Model model, Slide slide, List <Note> pattern, int times, int tickInterval) { #region 複製したSlideを新規作成 var after = slide.DeepCopy(); var patternLength = pattern.OrderBy(x => x.Position.Tick).Last().Position.Tick - pattern.OrderBy(x => x.Position.Tick).First().Position.Tick; for (int i = 1; i <= times; ++i) { var addPattern = ReplicatePattern(pattern); addPattern.ForEach(x => { var tick = x.Position.Tick; tick += i * (patternLength + tickInterval); x.RelocateOnly(new Position(x.Position.Lane, tick)); slide.Add(x); var sameTick = slide.Find(y => y.Position.Tick == x.Position.Tick); if (sameTick != null) { slide.Remove(sameTick); } }); } var slideEnd = after.FindLast(x => x is SlideEnd); var endTap = after.Last(); if (slideEnd.Position.Tick <= endTap.Position.Tick) { slideEnd.RelocateOnly(endTap.Position); after.Remove(endTap); } #endregion Invoke += () => { model.NoteBook.UnPut(slide); model.NoteBook.Put(after); }; Undo += () => { model.NoteBook.UnPut(after); model.NoteBook.Put(slide); }; }