public void Save() { if (m_data == null) { return; } if (m_populating) { return; } string currentValue = m_value == null ? string.Empty : m_value.Reference; string selectedValue = (string)lstDropdown.SelectedItem; if (selectedValue == null) { selectedValue = string.Empty; } if (selectedValue != currentValue) { m_controller.StartTransaction(string.Format("Change '{0}' to '{1}'", m_definition.Attribute, selectedValue)); m_value = m_controller.CreateNewEditableObjectReference(m_data.Name, m_definition.Attribute, false); m_value.Reference = selectedValue; m_controller.EndTransaction(); } }
public void Populate(IEditorData data) { m_data = data; if (data == null) { m_value = null; return; } m_populating = true; PopulateList(); object attr = data.GetAttribute(m_definition.Attribute); IEditableObjectReference value = attr as IEditableObjectReference; if (value == null) { lstDropdown.Text = string.Empty; lstDropdown.IsEnabled = (attr == null); } else { lstDropdown.SelectedItem = value.Reference; lstDropdown.IsEnabled = !data.ReadOnly; } m_value = value; m_populating = false; }
public void Save() { if (m_data == null) return; if (m_populating) return; string currentValue = m_value == null ? string.Empty : m_value.Reference; string selectedValue = (string)lstDropdown.SelectedItem; if (selectedValue == null) selectedValue = string.Empty; if (selectedValue != currentValue) { m_controller.StartTransaction(string.Format("Change '{0}' to '{1}'", m_definition.Attribute, selectedValue)); m_value = m_controller.CreateNewEditableObjectReference(m_data.Name, m_definition.Attribute, false); m_value.Reference = selectedValue; m_controller.EndTransaction(); } }