Пример #1
0
        public Segment AddSegment(Packet currentPacket)
        {
            var segment = new Segment {
                Name        = "",
                Description = "",
                OrderId     = currentPacket.Segments.Count + 1,
                Type        = new DataTypeView {
                    Type = DataType.Byte
                },
                Size = DataTypeView.SizeOfType(DataType.Byte)
            };

            currentPacket.Segments.Add(segment);
            return(segment);
        }
Пример #2
0
        private void CbDataTypeOnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (CurrentSegment == null)
            {
                return;
            }
            if (CbDataType.SelectedIndex == -1)
            {
                return;
            }
            CurrentSegment.Type = (DataTypeView)CbDataType.SelectedItem;
            var fixedSize = DataTypeView.SizeOfType(CurrentSegment.Type.Type);

            if (fixedSize > 0)
            {
                CurrentSegment.Size      = fixedSize;
                TxtSegmentSize.Text      = CurrentSegment.Size.ToString(CultureInfo.InvariantCulture);
                TxtSegmentSize.IsEnabled = false;
            }
            else
            {
                TxtSegmentSize.IsEnabled = true;
            }
        }