client/src/Iri.Modernisation.Controls/View/BookTimeLine/BookTimeLine.xaml.cs
changeset 0 249d70e7b32d
child 7 de7ba61f66c7
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/src/Iri.Modernisation.Controls/View/BookTimeLine/BookTimeLine.xaml.cs	Wed Nov 18 15:30:31 2009 +0100
@@ -0,0 +1,76 @@
+using System;
+using System.Windows.Data;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Animation;
+using System.Windows.Shapes;
+using Iri.Modernisation.Data.Models;
+using Iri.Modernisation.Controls.ViewModel;
+using Iri.Modernisation.BaseMVVM.Commands;
+namespace Iri.Modernisation.Controls.View
+{
+    public partial class BookTimeLine : UserControl
+    {
+        public BookTimeLine()
+        {
+            InitializeComponent();
+       
+            TimeStripsPanel.SizeChanged += new SizeChangedEventHandler(TimeStripsPanel_SizeChanged);
+            BookTimeLineSlider.MouseLeftButtonUp += Commands.TimeChange.Execute;
+        }
+		
+        void TimeStripsPanel_SizeChanged(object sender, SizeChangedEventArgs e)
+        {
+            Draw();
+        }
+
+       
+        public void Draw()
+        {
+            BookTimeLineVM VM = (BookTimeLineVM)DataContext;
+            BookTimeLineElementPanel.Children.Clear();
+            foreach (List<SegmentIndex> LIndex in VM.SegmentIndex)
+            {
+                foreach (SegmentIndex Index in LIndex)
+                {
+                   
+                    PolemicElementControl pol = new PolemicElementControl();
+                    
+                    pol.SetValue(Canvas.ZIndexProperty, 10);
+                    pol.DataContext = new PolemicElementVM(Index);
+                    BookTimeLineElementPanel.Children.Add(pol);
+                    Canvas.SetLeft(pol, (Index.TimerIn.TotalMilliseconds * ScaleTimeLine.Value) / VM.TotalDuration);
+                    pol.Width = (Index.Duration.TotalMilliseconds * ScaleTimeLine.Value) / VM.TotalDuration;
+                }
+            }
+            int basi = 30;
+            foreach (List<Annotation> LAnnotation in VM.Annotations)
+            {
+                foreach (Annotation Annotation in LAnnotation)
+                {
+                    PolemicElementControl pol = new PolemicElementControl();
+                    pol.SetValue(Canvas.ZIndexProperty, 10);
+                    pol.DataContext = new PolemicElementVM(Annotation);
+                    BookTimeLineElementPanel.Children.Add(pol);
+                    Canvas.SetLeft(pol, (Annotation.TimerIn.TotalMilliseconds * ScaleTimeLine.Value) / VM.TotalDuration);
+                    Canvas.SetTop(pol, basi);
+                    basi += 10;
+                    pol.Width = (Annotation.Duration.TotalMilliseconds * ScaleTimeLine.Value) / VM.TotalDuration;
+                }
+            }
+            BookTimeLineElementPanel.UpdateLayout();
+        }
+
+        
+        
+        
+       
+    }
+
+}