public void DeleteSelectedValue() { if (SelectedAttributeChoice != null) { _iKeyManager.Delete(SelectedAttributeChoice); AttributeChoices.Remove(SelectedAttributeChoice); AssignPositions(); } }
public void Save() { _attribute.description = Text; if (_attribute.id == 0) { _attribute.key_id = _key.id; _iKeyManager.Insert(_attribute, AttributeChoices.ToList()); } else { _iKeyManager.Update(_attribute, AttributeChoices.ToList()); } }
public void Add(Library.DBObject.AttributeChoice attributeValue) { int index = SelectedAttributeChoice != null ? SelectedAttributeChoice.position : 0; if (index < AttributeChoices.Count) { ++index; } _iKeyManager.Insert(attributeValue); AttributeChoices.Insert(index, attributeValue); AssignPositions(); SelectedAttributeChoice = AttributeChoices[index]; }
public void MoveSelectedAttributeDown() { if (!CanMoveValueDown) { return; } int index = AttributeChoices.IndexOf(SelectedAttributeChoice); AttributeChoices[index].position = (short)(index + 1); AttributeChoices[index + 1].position = (short)index; _iKeyManager.Update(AttributeChoices[index]); _iKeyManager.Update(AttributeChoices[index + 1]); AttributeChoices = new ObservableCollection <Library.DBObject.AttributeChoice>(AttributeChoices.OrderBy(n => n.position)); SelectedAttributeChoice = AttributeChoices[index + 1]; }
public void Refresh() { int index = (SelectedAttributeChoice != null) ? SelectedAttributeChoice.position : -1; AttributeChoices = new ObservableCollection <Library.DBObject.AttributeChoice>(AttributeChoices.OrderBy(n => n.position)); if (index != -1) { SelectedAttributeChoice = AttributeChoices[index]; } }