|
|
|
@ -119,14 +119,46 @@ namespace GBase |
|
|
|
return Columns.Remove(column); |
|
|
|
return Columns.Remove(column); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private bool AddEntry(object entry) //TODO: Write to file |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Entries.Add(entry); |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private bool ModifyEntry(object entry, string propertyName, object value) //TODO: Write to file |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
PropertyInfo property = entry.GetType().GetProperty(propertyName); |
|
|
|
|
|
|
|
if (property == null) |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
property.SetValue(entry, value); |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private bool RemoveEntry(object entry) //TODO: remove from file |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (!Entries.Contains(entry)) |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Entries.Remove(entry); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// <summary> |
|
|
|
/// A <see cref="IGBase"/> entry changed |
|
|
|
/// A <see cref="IGBase"/> entry changed |
|
|
|
/// </summary> |
|
|
|
/// </summary> |
|
|
|
/// <param name="sender">The sender</param> |
|
|
|
/// <param name="entry">The entry (sender)</param> |
|
|
|
/// <param name="args">The <see cref="GBaseEntryChangedEventArgs"/></param> |
|
|
|
/// <param name="args">The <see cref="GBaseEntryChangedEventArgs"/></param> |
|
|
|
private void OnGBaseEntryChanged(object sender, GBaseEntryChangedEventArgs args) |
|
|
|
private void OnGBaseEntryChanged(object entry, GBaseEntryChangedEventArgs args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
//TODO: Implement function, depending on #23 |
|
|
|
//TODO: Might change, depending on #23 |
|
|
|
|
|
|
|
bool success; |
|
|
|
|
|
|
|
if (!Entries.Contains(entry)) |
|
|
|
|
|
|
|
success = AddEntry(entry); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
success = ModifyEntry(entry, args.ColumnName, args.Value); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!success) |
|
|
|
|
|
|
|
throw new Exception("Failed to handle EntryChanged"); //TODO: Decide what to do here |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// <summary> |
|
|
|
|