Working comments with CommentPool.

This commit is contained in:
Daniel Kraus
2015-08-30 07:48:32 +02:00
parent a89a8103e5
commit 02b4bc07a3
11 changed files with 285 additions and 106 deletions

View File

@ -24,6 +24,7 @@ using Microsoft.Office.Interop.Word;
using zaaReloaded2.LabModel;
using zaaReloaded2.Formatter;
using System.Runtime.Serialization;
using zaaReloaded2.Controller.Comments;
namespace zaaReloaded2.Controller.Elements
{
@ -94,15 +95,6 @@ namespace zaaReloaded2.Controller.Elements
#endregion
#region Events
/// <summary>
/// Propagates the FillInComment events of collected items.
/// </summary>
public event EventHandler<ItemCommentEventArgs> FillInComment;
#endregion
#region Constructors
public Items() : base() { }
@ -202,12 +194,10 @@ namespace zaaReloaded2.Controller.Elements
{
// First, check if the item name contains an optional comment
// definition
ItemComment comment = ItemComment.FromDefinition(name);
ItemComment comment = CommentPool.Default.GetCommentFor(name);
if (comment != null)
{
name = comment.Item;
// Enable propagation of FillInComment events
comment.FillInComment += comment_FillInComment;
}
// Then, see if we have such an item
@ -228,23 +218,6 @@ namespace zaaReloaded2.Controller.Elements
return items;
}
void comment_FillInComment(object sender, ItemCommentEventArgs e)
{
OnFillInComment(e);
}
#endregion
#region Protected methods
protected virtual void OnFillInComment(ItemCommentEventArgs args)
{
EventHandler<ItemCommentEventArgs> h = FillInComment;
if (h != null)
{
h(this, args);
}
}
#endregion
#region Fields