Пример #1
0
        protected void InitializePrimaryPrimitiveAndBound(AbstractPrimitive pri, AbstractRectangle b)
        {
            if (pri != null)
            {
                if (__primaryPrimitive != null)
                {
                    __primaryPrimitive.FillPattern.PropertyChanged   -= PropertyChanged;
                    __primaryPrimitive.BorderPattern.PropertyChanged -= PropertyChanged;
                    __primaryPrimitive.Dispose();
                }

                __primaryPrimitive = pri;
                __primaryPrimitive.FillPattern.PropertyChanged   += PropertyChanged;
                __primaryPrimitive.BorderPattern.PropertyChanged += PropertyChanged;
            }

            if (b != null)
            {
                if (__bound != null)
                {
                    __bound.FillPattern.PropertyChanged   -= PropertyChanged;
                    __bound.BorderPattern.PropertyChanged -= PropertyChanged;
                    __bound.Dispose();
                }

                __bound = b;
                __bound.FillPattern.PropertyChanged   += PropertyChanged;
                __bound.BorderPattern.PropertyChanged += PropertyChanged;
            }
        }
Пример #2
0
        /// <summary>
        /// Processes the segment.
        /// Loops through all of the fields within the segment, and parsing them individually.
        /// </summary>
        /// <param name="segment">The segment.</param>
        /// <param name="parentNode">The parent node.</param>
        private static void ProcessSegmentNew(AbstractSegment segment, FieldGroup parentNode)
        {
            FieldGroup segmentNode = new FieldGroup()
            {
                Name = segment.GetStructureName(), Id = segment.GetStructureName()
            };
            int dataItemCount = 0;

            for (int i = 1; i <= segment.NumFields(); i++)
            {
                dataItemCount++;
                IType[] dataItems = segment.GetField(i);
                foreach (IType item in dataItems)
                {
                    ProcessFieldNew(item, segment.GetFieldDescription(i), dataItemCount.ToString(), segmentNode);
                }

                if (dataItems.Count() == 0 && segmentNode.FieldList.Count > 0)
                {
                    AbstractPrimitive msg = null;
                    ProcessPrimitiveFieldNew((AbstractPrimitive)msg, segment.GetFieldDescription(i), dataItemCount.ToString(), segmentNode);
                }
            }

            AddChildGroupNew(parentNode, segmentNode);
        }
Пример #3
0
        /// <summary>
        /// Processes the primitive field.
        /// A primitive field is the most basic type (i.e. no composite fields).  This function retrieves the data
        /// and builds the node in the TreeListView.
        /// </summary>
        /// <param name="dataItem">The data item.</param>
        /// <param name="fieldDescription">The field description.</param>
        /// <param name="fieldCount">The field count.</param>
        /// <param name="parentNode">The parent node.</param>
        private static void ProcessPrimitiveFieldNew(AbstractPrimitive dataItem, string fieldDescription, string fieldCount, FieldGroup parentNode)
        {
            int index = parentNode.Id.IndexOf(".");

            if (dataItem != null)
            {
                string desc   = fieldDescription == string.Empty ? dataItem.Description : fieldDescription;
                string typnam = System.Text.RegularExpressions.Regex.Replace(dataItem.TypeName, @"ComponentOne", @"1");

                if (!string.IsNullOrEmpty(dataItem.Value))
                {
                    parentNode.FieldList.Add(new FieldGroup()
                    {
                        Name = fieldCount.ToString() + " - " + desc, Id = parentNode.Id + "." + fieldCount, Value = dataItem.Value
                    });
                }
                else if (index == -1)
                {
                    //if (parentNode.Id.Substring(index).Length == 0)
                    //{
                    parentNode.FieldList.Add(new FieldGroup()
                    {
                        Name = fieldCount.ToString() + " - " + desc, Id = parentNode.Id + "." + fieldCount, Value = dataItem.Value
                    });
                    //}
                }
            }
            else
            {
                parentNode.FieldList.Add(new FieldGroup()
                {
                    Name = fieldCount.ToString() + " - " + fieldDescription, Id = parentNode.Id + "." + fieldCount, Value = string.Empty
                });
            }
        }
Пример #4
0
        /// <summary>
        /// Processes the primitive field.
        /// A primitive field is the most basic type (i.e. no composite fields).  This function retrieves the data
        /// and builds the node in the TreeListView.
        /// </summary>
        /// <param name="dataItem">The data item.</param>
        /// <param name="fieldDescription">The field description.</param>
        /// <param name="fieldCount">The field count.</param>
        /// <param name="parentNode">The parent node.</param>
        private void ProcessPrimitiveField(AbstractPrimitive dataItem, string fieldDescription, string fieldCount, FieldGroup parentNode)
        {
            string desc = fieldDescription == string.Empty ? dataItem.Description : fieldDescription;

            if (!string.IsNullOrEmpty(dataItem.Value))
            {
                parentNode.FieldList.Add(new Field()
                {
                    Name = desc, Id = fieldCount, Value = dataItem.Value
                });
            }
        }
Пример #5
0
        /// <summary>
        /// Processes the primitive field.
        /// A primitive field is the most basic type (i.e. no composite fields).  This function retrieves the data
        /// and builds the node in the TreeListView.
        /// </summary>
        /// <param name="dataItem">The data item.</param>
        /// <param name="fieldDescription">The field description.</param>
        /// <param name="fieldCount">The field count.</param>
        /// <param name="parentNode">The parent node.</param>
        private static void ProcessPrimitiveField(AbstractPrimitive dataItem, string fieldDescription, string fieldCount, FieldGroup parentNode)
        {
            string desc = fieldDescription == string.Empty ? dataItem.Description : fieldDescription;

            string typnam = System.Text.RegularExpressions.Regex.Replace(dataItem.TypeName, @"ComponentOne", @"1");

            if (!string.IsNullOrEmpty(dataItem.Value))
            {
                parentNode.FieldList.Add(new FieldGroup()
                {
                    Name = parentNode.Id + "." + fieldCount.ToString() + " - " + (string.IsNullOrEmpty(desc) ? "Unknown" : desc), Id = parentNode.Id + "." + fieldCount, Value = dataItem.Value
                });
            }
        }
Пример #6
0
        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    if (Region != null)
                    {
                        Region.Dispose();
                    }

                    if (__widenPen != null)
                    {
                        __widenPen.Dispose();
                    }

                    if (__primaryPrimitive != null)
                    {
                        __primaryPrimitive.Dispose();
                    }

                    if (__bound != null)
                    {
                        __bound.Dispose();
                    }

                    DisposeAnchorsAndResizeHandles();
                }

                FillPattern        = null;
                Region             = null;
                __primaryPrimitive = null;

                disposedValue = true;
            }
        }
Пример #7
0
 /// <summary>
 /// Determines if an abstract primitive is empty
 /// </summary>
 public static bool IsEmpty(this AbstractPrimitive me)
 {
     return(String.IsNullOrEmpty(me.Value));
 }