Beispiel #1
0
        private void PopulateProperties(IPropertyObject propertyBag, MessageClass objectType)
        {
            lvProperties.Items.Clear();
            hexBox1.ByteProvider = null;
            _propertyObject      = propertyBag;

            foreach (PropId prop in propertyBag.Properties)
            {
                try
                {
                    var propertyItem = new ListViewItem();

                    var propertyInfo = _dataProvider.GetPropertyInformation(prop, objectType);
                    if (propertyInfo != null)
                    {
                        propertyItem.Tag  = propertyInfo;
                        propertyItem.Text = propertyInfo.PropertyName;

                        var toolTipText = new StringBuilder();
                        toolTipText.AppendLine(string.Format("Value: 0x{0:X4}", propertyInfo.PropertyId));
                        toolTipText.AppendLine(string.Format("Type: {0}", propertyInfo.DataType));
                        toolTipText.AppendLine(string.Format("Description {0}", propertyInfo.Description));

                        propertyItem.ToolTipText = toolTipText.ToString();
                    }
                    else
                    {
                        //propertyItem.Tag = new PropertyInformation(prop);
                        propertyItem.Text = "0x" + prop.Value.ToString("X4");
                        propertyItem.Tag  = prop;
                    }

                    var size = new ListViewItem.ListViewSubItem(propertyItem, propertyBag.PropertySize(prop).ToString());
                    propertyItem.SubItems.Add(size);

                    lvProperties.Items.Add(propertyItem);
                }
                catch (Exception)
                {
                    var id = new ListViewItem("0x" + prop.Value.ToString("X4"));

                    var size = new ListViewItem.ListViewSubItem(id, propertyBag.PropertySize(prop).ToString());
                    id.SubItems.Add(size);
                    id.Tag = prop;

                    lvProperties.Items.Add(id);
                }
            }
        }
Beispiel #2
0
 public uint PropertySize(PropId id)
 {
     return(_propBag.PropertySize(id));
 }