|
|
|
@ -21,7 +21,7 @@ namespace GBase |
|
|
|
/// <summary> |
|
|
|
/// <summary> |
|
|
|
/// A <see cref="IGBase"/> table |
|
|
|
/// A <see cref="IGBase"/> table |
|
|
|
/// </summary> |
|
|
|
/// </summary> |
|
|
|
public class GBaseTable : IGBaseTable |
|
|
|
public class GBaseTable<T> : IGBaseTable<T> where T : INotifyGBaseEntryChanged |
|
|
|
{ |
|
|
|
{ |
|
|
|
private readonly IFileHandler _fileHandler; |
|
|
|
private readonly IFileHandler _fileHandler; |
|
|
|
private readonly IGBaseColumnFactory _gBaseColumnFactory; |
|
|
|
private readonly IGBaseColumnFactory _gBaseColumnFactory; |
|
|
|
@ -35,7 +35,7 @@ namespace GBase |
|
|
|
_gBaseColumnFactory = gBaseColumnFactory; |
|
|
|
_gBaseColumnFactory = gBaseColumnFactory; |
|
|
|
|
|
|
|
|
|
|
|
Columns = new List<IGBaseColumn>(); |
|
|
|
Columns = new List<IGBaseColumn>(); |
|
|
|
Entries = new List<object>(); |
|
|
|
Entries = new List<T>(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -57,7 +57,7 @@ namespace GBase |
|
|
|
/// <summary> |
|
|
|
/// <summary> |
|
|
|
/// The entries of this <see cref="IGBaseTable"/> |
|
|
|
/// The entries of this <see cref="IGBaseTable"/> |
|
|
|
/// </summary> |
|
|
|
/// </summary> |
|
|
|
public List<object> Entries { get; } |
|
|
|
public List<T> Entries { get; } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// <summary> |
|
|
|
@ -123,7 +123,7 @@ namespace GBase |
|
|
|
/// </summary> |
|
|
|
/// </summary> |
|
|
|
/// <param name="entry">The entry implementing <see cref="INotifyGBaseEntryChanged"/></param> |
|
|
|
/// <param name="entry">The entry implementing <see cref="INotifyGBaseEntryChanged"/></param> |
|
|
|
/// <returns>True if successful, false if not</returns> |
|
|
|
/// <returns>True if successful, false if not</returns> |
|
|
|
public bool AddEntry(INotifyGBaseEntryChanged entry) //TODO: Write to file |
|
|
|
public bool AddEntry(T entry) //TODO: Write to file |
|
|
|
{ |
|
|
|
{ |
|
|
|
Entries.Add(entry); |
|
|
|
Entries.Add(entry); |
|
|
|
entry.GBaseEntryChanged += OnGBaseEntryChanged; |
|
|
|
entry.GBaseEntryChanged += OnGBaseEntryChanged; |
|
|
|
@ -136,7 +136,7 @@ namespace GBase |
|
|
|
/// </summary> |
|
|
|
/// </summary> |
|
|
|
/// <param name="entry">The entry implementing <see cref="INotifyGBaseEntryChanged"/></param> |
|
|
|
/// <param name="entry">The entry implementing <see cref="INotifyGBaseEntryChanged"/></param> |
|
|
|
/// <returns>True if successful, false if not</returns> |
|
|
|
/// <returns>True if successful, false if not</returns> |
|
|
|
public bool RemoveEntry(INotifyGBaseEntryChanged entry) //TODO: remove from file |
|
|
|
public bool RemoveEntry(T entry) //TODO: remove from file |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!Entries.Contains(entry)) |
|
|
|
if (!Entries.Contains(entry)) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
@ -188,7 +188,7 @@ namespace GBase |
|
|
|
|
|
|
|
|
|
|
|
Columns.Clear(); |
|
|
|
Columns.Clear(); |
|
|
|
|
|
|
|
|
|
|
|
foreach (var entry in Entries.OfType<INotifyGBaseEntryChanged>().ToList()) |
|
|
|
foreach (var entry in Entries.ToList()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
RemoveEntry(entry); |
|
|
|
RemoveEntry(entry); |
|
|
|
} |
|
|
|
} |
|
|
|
|