|
1 using System; |
|
2 using System.Windows.Data; |
|
3 using System.Collections.Generic; |
|
4 using System.Linq; |
|
5 using System.Net; |
|
6 using System.Windows; |
|
7 using System.Windows.Controls; |
|
8 using System.Windows.Documents; |
|
9 using System.Windows.Input; |
|
10 using System.Windows.Media; |
|
11 using System.Windows.Media.Animation; |
|
12 using System.Windows.Shapes; |
|
13 using Iri.Modernisation.Data.Models; |
|
14 using Iri.Modernisation.Controls.ViewModel; |
|
15 using Iri.Modernisation.BaseMVVM.Commands; |
|
16 namespace Iri.Modernisation.Controls.View |
|
17 { |
|
18 public partial class BookTimeLine : UserControl |
|
19 { |
|
20 public BookTimeLine() |
|
21 { |
|
22 InitializeComponent(); |
|
23 |
|
24 TimeStripsPanel.SizeChanged += new SizeChangedEventHandler(TimeStripsPanel_SizeChanged); |
|
25 BookTimeLineSlider.MouseLeftButtonUp += Commands.TimeChange.Execute; |
|
26 } |
|
27 |
|
28 void TimeStripsPanel_SizeChanged(object sender, SizeChangedEventArgs e) |
|
29 { |
|
30 Draw(); |
|
31 } |
|
32 |
|
33 |
|
34 public void Draw() |
|
35 { |
|
36 BookTimeLineVM VM = (BookTimeLineVM)DataContext; |
|
37 BookTimeLineElementPanel.Children.Clear(); |
|
38 foreach (List<SegmentIndex> LIndex in VM.SegmentIndex) |
|
39 { |
|
40 foreach (SegmentIndex Index in LIndex) |
|
41 { |
|
42 |
|
43 PolemicElementControl pol = new PolemicElementControl(); |
|
44 |
|
45 pol.SetValue(Canvas.ZIndexProperty, 10); |
|
46 pol.DataContext = new PolemicElementVM(Index); |
|
47 BookTimeLineElementPanel.Children.Add(pol); |
|
48 Canvas.SetLeft(pol, (Index.TimerIn.TotalMilliseconds * ScaleTimeLine.Value) / VM.TotalDuration); |
|
49 pol.Width = (Index.Duration.TotalMilliseconds * ScaleTimeLine.Value) / VM.TotalDuration; |
|
50 } |
|
51 } |
|
52 int basi = 30; |
|
53 foreach (List<Annotation> LAnnotation in VM.Annotations) |
|
54 { |
|
55 foreach (Annotation Annotation in LAnnotation) |
|
56 { |
|
57 PolemicElementControl pol = new PolemicElementControl(); |
|
58 pol.SetValue(Canvas.ZIndexProperty, 10); |
|
59 pol.DataContext = new PolemicElementVM(Annotation); |
|
60 BookTimeLineElementPanel.Children.Add(pol); |
|
61 Canvas.SetLeft(pol, (Annotation.TimerIn.TotalMilliseconds * ScaleTimeLine.Value) / VM.TotalDuration); |
|
62 Canvas.SetTop(pol, basi); |
|
63 basi += 10; |
|
64 pol.Width = (Annotation.Duration.TotalMilliseconds * ScaleTimeLine.Value) / VM.TotalDuration; |
|
65 } |
|
66 } |
|
67 BookTimeLineElementPanel.UpdateLayout(); |
|
68 } |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 } |
|
75 |
|
76 } |