/// <summary> /// Initializes a new instance of the <see cref="EntryViewModel"/> class. /// </summary> public EntryViewModel(IList <Entry> entries) { DisplayName = "Root"; ValueType = EntryValueType.Class; SubEntries = new ObservableWrapperCollection(entries); UpdateParent(); }
/// <summary> /// Initializes a new instance of the <see cref="EntryViewModel"/> class. /// </summary> public EntryViewModel(Entry entry) { Entry = entry; DisplayName = Entry.DisplayName; ValueType = Entry.Value.Type; UnitType = Entry.Value.UnitType; SubEntries = new ObservableWrapperCollection(entry.SubEntries); UpdateParent(); }
/// <summary> /// Replace the current entry structure with a prototype instance /// </summary> public void ReplaceWithPrototype(string prototypeName) { // Create new instance var prototype = Entry.GetPrototype(prototypeName).Instantiate(); // Update entry Entry.Value = prototype.Value; Entry.SubEntries = prototype.SubEntries; // Update our observable collection SubEntries = new ObservableWrapperCollection(Entry.SubEntries); UpdateParent(); }