public void SetValue(object value) { if (this.Line == null) { this.Line = GetNewLine(); if (throwEvent && Added != null) { Added(this); } } if (value is IList) { var liste = value as IList; throwEvent = false; for (int i = 0; i < liste.Count; i++) { LineItem item = new LineItem(this.Line.itemListChangeHandler.Items.Count + 1, liste[i]); LineItemField field = this.Add(item); if (field != null) { this.Line.AddLineItem(field.LineItem); } } throwEvent = true; if (liste.Count > 0 && throwEvent && Added != null) { Updated(this); } } else { LineItem item = new LineItem(this.Line.itemListChangeHandler.Items.Count + 1, value); this.Add(item); } }
private void OnActivated(object item) { LineItemField field = (LineItemField)item; if (throwEvent && Activated != null) { Activated(this); } }
public LineItemField Add(LineItemField field) { field.Deleted += OnDeleted; field.Activated += OnActivated; Panel.Children.Add(field); if (this.Line == null) { this.Line = GetNewLine(); } if (throwEvent) { this.Line.AddLineItem(field.LineItem); } if (throwEvent && Updated != null) { Updated(this); } return(field); }
public void Display(DesignDimensionLine Line) { throwEvent = false; this.Clear(); this.Line = Line; if (this.Line == null) { this.Line = GetNewLine(); } int index = 1; foreach (LineItem item in Line.itemListChangeHandler.Items) { LineItemField itemField = new LineItemField(item); Add(itemField); index++; } throwEvent = true; }
public void Remove(LineItemField field) { Panel.Children.Remove(field); if (this.Line == null) { this.Line = GetNewLine(); } this.Line.RemoveLineItem(field.LineItem); int index = 1; foreach (object pan in Panel.Children) { ((LineItemField)pan).Index = index++; } if (throwEvent && Updated != null) { Updated(this); } }
private void OnDeleted(object item) { LineItemField field = (LineItemField)item; this.Remove(field); }
public LineItemField Add(LineItem item) { LineItemField field = new LineItemField(item); return(this.Add(field));; }