Choreoh.MainWindow.renderComment C# (CSharp) Method

renderComment() private method

private renderComment ( Choreoh.DanceSegment segment ) : void
segment Choreoh.DanceSegment
return void
        private void renderComment(DanceSegment segment)
        {
            double pos;
            String comment;
            int frame = 0;
            if (routine.comments.TryGetValue(segment, out comment))
            {
                if (comment == null) Debug.WriteLine("THIS COMMENT IS NULL! WHYYYYYY?!");
                if (comment == null) return;
                Debug.WriteLine("THIS COMMENT SHOULD HAVE RENDERED: " + comment);
                foreach (KeyValuePair<int, DanceSegment> kvp in routine.segments)
                {
                    if (kvp.Value == selectedSegment)
                    {
                        frame = kvp.Key;
                        break;
                    }
                }
                pos = (frame + (segment.length/2)) / 30 * waveform.getPixelsPerSecond();
                Image cImg = new Image
                {
                    Height = 160,
                    Width = 40,
                };
                cImg.Source = new BitmapImage(new Uri(@"pack://application:,,,/Choreoh;component/img/waveform/speech_bubble.png", UriKind.RelativeOrAbsolute));
                HoverButton commentImg = new HoverButton
                {
                    Height = 50,
                    Width = 50,
                    Visibility = Visibility.Visible,
                    BackgroundColor = Brushes.LavenderBlush
                };
                commentImg.leftImageName.Source = cImg.Source;
                segmentCanvas.Children.Add(commentImg);
                Canvas.SetTop(commentImg, 0);
                Canvas.SetLeft(commentImg, pos);
                Canvas.SetZIndex(commentImg, 100);
                segmentList.AddLast(commentImg);
            }
        }