public bool LockEnd()
{
bool result = false;
Logger.Debug ("locking end");
var end = End;
if (Buffer.GetDynamicTag ("tasklist", end) != Tag) {
result = true;
Logger.Debug ("inserting \\n");
Buffer.Insert (ref end, System.Environment.NewLine);
if (Buffer.GetIterAtMark (Buffer.InsertMark).Equal (end)) {
end.BackwardChar ();
Buffer.PlaceCursor (end);
}
}
end = End;
var start = end;
end.ForwardChar ();
Buffer.ApplyTag ("locked", start, end);
return result;
}
/// <summary> /// Transfer all the tasks to another tasklist, used for merging /// </summary> /// <param name="tasklist"> /// The other <see cref="TaskList"/> tasklist to send the tasks to /// </param> public void TransferTasksTo(TaskList tasklist) { List<Task> to_transfer = new List<Task> (); foreach (Task task in Tasks) { if (!task.WasDeleted) { Logger.Debug ("adding task " + task.Description ()); to_transfer.Add (task); } } foreach (Task task in to_transfer) { tasklist.AddFinishedTask (task); task.RemoveTag (Tag); Tasks.Remove (task); } Delete (); tasklist.LockEnd (); }