// // API // public void Clear() { colorPool = new ColorPool(); // The first color is white, skip it colorPool.GetColorForId("MultiSessionView1"); DeleteSessions(sessions.ToArray()); }
private Bitmap GetHeadingBitmap() { int w = headingColsRect.X + (sessions.Count * (colWidth + colSpacing)); int h = headingColsRect.Y + headingColsRect.Height + 3; // FIXME Bitmap bitmap = new Bitmap(w, h); Graphics g = Graphics.FromImage(bitmap); ExtendedGraphics eg = new ExtendedGraphics(g); Brush fgBrush = new SolidBrush(Color.White); Font headerFont = new Font("Tahoma", 10, FontStyle.Bold); int x = headingColsRect.X; Pen selectedPen = new Pen(Color.Black, 3); foreach (VisualSession stream in sessions) { string localEpStr = stream.LocalEndpoint.ToString(); string remoteEpStr = stream.RemoteEndpoint.ToString(); string str; if (localEpStr.Length > 0 && remoteEpStr.Length > 0) { str = String.Format("{0} <-> {1}", localEpStr, remoteEpStr); } else { str = "<UNKNOWN ENDPOINTS>"; } Brush bgBrush = new SolidBrush(colorPool.GetColorForId(Convert.ToString(str.GetHashCode()))); eg.FillRoundRectangle(bgBrush, x, headingColsRect.Y, colWidth, headingColsRect.Height, 2.0f); if (selectedSessions.ContainsKey(stream)) { eg.DrawRoundRectangle(selectedPen, x, headingColsRect.Y, colWidth, headingColsRect.Height, 2.0f); } SizeF fs = g.MeasureString(str, headerFont); g.DrawString(str, headerFont, fgBrush, x + (colWidth / 2) - (fs.Width / 2), headingColsRect.Y + ((headingColsRect.Height / 2) - (fs.Height / 2))); x += colWidth + colSpacing; } return(bitmap); }
public MSNSLPCall(string callID) { this.callID = callID; color = colorPool.GetColorForId(callID); }