public ProjectInsertLineCommand( ProjectLineBuffer lineBuffer, Project project, LinePosition line) : base(project) { // Save the line buffer for later. this.lineBuffer = lineBuffer; this.line = line; // Create the project command wrapper. var block = new Block(project.Blocks); var command = new InsertIndexedBlockCommand(line.Index, block); // Set the command into the adapter. Command = command; }
public override LineBufferOperationResults InsertLines( int lineIndex, int count) { var composite = new CompositeCommand <BlockCommandContext>(true, false); using (project.Blocks.AcquireLock(RequestLock.Write)) { for (int i = 0; i < count; i++) { var block = new Block(project.Blocks); var command = new InsertIndexedBlockCommand(lineIndex, block); composite.Commands.Add(command); } var context = new BlockCommandContext(project); project.Commands.Do(composite, context); return(GetOperationResults()); } }