예제 #1
0
 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);
     }
 }
예제 #2
0
        private void OnActivated(object item)
        {
            LineItemField field = (LineItemField)item;

            if (throwEvent && Activated != null)
            {
                Activated(this);
            }
        }
예제 #3
0
 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);
 }
예제 #4
0
        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;
        }
예제 #5
0
        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);
            }
        }
예제 #6
0
        private void OnDeleted(object item)
        {
            LineItemField field = (LineItemField)item;

            this.Remove(field);
        }
예제 #7
0
        public LineItemField Add(LineItem item)
        {
            LineItemField field = new LineItemField(item);

            return(this.Add(field));;
        }