Exemplo n.º 1
0
        void DrawEpisode(EpisodeViewModel episode)
        {
            var h  = (TargetCanvas.ActualHeight - BottomMargin) * 0.9;
            var x1 = GetPosition(GetEpisodeStartTime(episode));
            var x2 = GetPosition(GetEpisodeStartTime(episode) + episode.SpendTime);
            var b  = new Border()
            {
                BorderThickness = new Windows.UI.Xaml.Thickness()
                {
                    Left = 3, Right = 3, Top = 1, Bottom = 1
                },
                BorderBrush = new SolidColorBrush(Colors.YellowGreen),

                Height            = h,
                Width             = x2 - x1,
                VerticalAlignment = VerticalAlignment.Center
            };

            Canvas.SetLeft(b, x1);
            Canvas.SetTop(b, TargetCanvas.ActualHeight - h);
            var t = new TextBlock()
            {
                Text = episode.EpisodeName.ToString(),
                HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Top
            };

            b.Child = t;

            TargetCanvas.Children.Add(b);
        }
Exemplo n.º 2
0
        TimeSpan GetEpisodeStartTime(EpisodeViewModel episode)
        {
            var t = new TimeSpan();

            foreach (var e in EpisodeList)
            {
                if (e.TargetObject == episode)
                {
                    return(t);
                }
                t = t + e.SpendTime;
            }
            return(t);
        }