Ejemplo n.º 1
0
 public StreamListItem(Stream stream, Graph graph)
 {
     this.stream = stream;
     this.graph = graph;
 }
Ejemplo n.º 2
0
        void RebuildList()
        {
            ColorGenerator colorGenerator = new ColorGenerator();
            List<Graph> graphs = new List<Graph>();

            streamsList.Groups.Clear();
            streamsList.Items.Clear();

            foreach (PortData portData in session.Capture.PortsData)
            {
                ListViewGroup group = new ListViewGroup(portData.Name);
                streamsList.Groups.Add(group);

                foreach (Stream stream in portData.Streams)
                {
                    Graph graph = new Graph(drawer, diagram, stream.EntryData);
                    Krach.Graphics.Color color = colorGenerator.NextColor();
                    graph.Color = System.Drawing.Color.FromArgb((int)(color.Alpha * 0xFF), (int)(color.Red * 0xFF), (int)(color.Green * 0xFF), (int)(color.Blue * 0xFF));

                    graphs.Add(graph);

                    ListViewItem item = new ListViewItem();
                    item.Name = portData.Name + "Stream" + stream.Path;
                    item.Text = stream.Name;
                    item.SubItems.Add(new ListViewItem.ListViewSubItem(item, stream.Path.ToString()));
                    item.Group = group;
                    item.Checked = true;
                    item.Tag = new StreamListItem(stream, graph);

                    SetColor(item, graph.Color);

                    streamsList.Items.Add(item);
                }
            }

            diagram.Graphs = graphs;
        }