private void LoadData()
{
if (!HasChanges)
{
_metadata.Clear();
_changes.Clear();
if (NodeProxy != null && NodeProxy.Metadata != null)
{
List<MetadataViewModel> sortedList = new List<MetadataViewModel>();
foreach (MetadataContext context in NodeProxy.Metadata.Keys)
{
/* The 'Note' property has it's own editor panel intended for more text
* The 'XPosition' and 'YPosition' are control via the map positioning
* The 'Name' is the node text and editing is done via the node directly
* The 'Created' and 'Modified' timestamps should not be able to be changed.
* TODO: Decide if the CreatedBy and ModifiedBy properties should be editable.
***/
if (context.MetadataName != "Note" && context.MetadataName != "XPosition"
&& context.MetadataName != "YPosition" && context.MetadataName != "Name"
&& context.MetadataName != "Created" && context.MetadataName != "Modified"
&& context.MetadataName != "CollapseState" && context.MetadataName != "Visibility")
{
MetadataViewModel model = new MetadataViewModel(context, NodeProxy.Metadata[context]);
if (!ContainsOriginal(context))
{
_original.Add(context, model.Clone());
}
_changes[model.OriginalMetadataName.ToLower()] = false;
model.PropertyChanged += new PropertyChangedEventHandler(model_PropertyChanged);
sortedList.Add(model);
}
}
sortedList.Sort(new Comparison<MetadataViewModel>(CompareMetadata));
foreach (MetadataViewModel model in sortedList)
{
_metadata.Add(model);
_metadataNames.Add(model.OriginalMetadataName);
}
}
}
}