public ValueCopySettingsWrapper GetCopySettings() { ValueCopySettingsWrapper wrapper = new ValueCopySettingsWrapper(); if (m_CopyType.Combo.SelectedIndex == 0) wrapper.CopyType = ValueCopyTypes.CopyValueFromSource; else wrapper.CopyType = ValueCopyTypes.DeliveryValuePropotrionalSource; try { wrapper.Coefficient = Convert.ToDouble(m_Coefficient.Text); } catch { wrapper.Coefficient = 1; } wrapper.Value = m_Value.Text; wrapper.ShowNotEmptyCoordinates = m_Coordinates.ShowNotEmpty; foreach (CoordinateItem item in m_Coordinates.CoordinatesList) { CoordinateItem_Wrapper item_wrapper = new CoordinateItem_Wrapper(item); wrapper.CoordinatesList.Add(item_wrapper); } return wrapper; }
public void Initialize(ValueCopySettingsWrapper wrapper) { if (wrapper != null) { m_Value.Text = wrapper.Value; m_Coefficient.Text = wrapper.Coefficient.ToString(); if (wrapper.CopyType == ValueCopyTypes.CopyValueFromSource) { m_CopyType.Combo.SelectedIndex = 0; } else { m_CopyType.Combo.SelectedIndex = 1; } m_Coordinates.ShowNotEmpty = wrapper.ShowNotEmptyCoordinates; List<CoordinateItem> coordinates = new List<CoordinateItem>(); foreach (CoordinateItem_Wrapper coord_wrap in wrapper.CoordinatesList) { CoordinateItem item = new CoordinateItem(coord_wrap); coordinates.Add(item); } m_Coordinates.Initialize(coordinates); } }