public Packet AddPacket(Protocol currentProtocol)
        {
            var packet = new Packet {
                                        Name = "",
                                        Description = "",
                                        Segments = new List<Segment>()
                                    };

            var win = new PacketEditWindow(packet);
            var showDialog = win.ShowDialog();
            if (showDialog != null && (bool) showDialog) {
                currentProtocol.Packets.Add(packet);
                return packet;
            }

            return null;
        }
 public ProtocolPropertiesWindow(Protocol protocol)
 {
     InitializeComponent();
     DataContext = protocol;
 }
 public void ShowEditProtocolWindow(Protocol protocol)
 {
     var window = new ProtocolPropertiesWindow(protocol);
     window.ShowDialog();
 }
 public void CreateProtocol()
 {
     var protocol = new Protocol {
         Name = "New protocol",
         Packets = new List<Packet>()
     };
     Protocols = Protocols ?? new List<Protocol>();
     var window = new ProtocolPropertiesWindow(protocol);
     var showDialog = window.ShowDialog();
     if (showDialog != null && (bool) showDialog)
         Protocols.Add(protocol);
 }