|
1 using System; |
|
2 using System.Collections.Generic; |
|
3 using System.Linq; |
|
4 using System.Net; |
|
5 using System.Windows; |
|
6 using System.Windows.Controls; |
|
7 using System.Windows.Documents; |
|
8 using System.Windows.Input; |
|
9 using System.Windows.Media; |
|
10 using System.Windows.Media.Animation; |
|
11 using System.Windows.Shapes; |
|
12 using Iri.Modernisation.Controls.ViewModel; |
|
13 namespace Iri.Modernisation.Controls.View |
|
14 { |
|
15 |
|
16 public partial class CustomableVideoElement : UserControl |
|
17 { |
|
18 public double TrimLeft |
|
19 { |
|
20 get { return (double)GetValue(TrimLeftProperty); } |
|
21 set |
|
22 { |
|
23 |
|
24 if(((CustomableVideoElementVM)DataContext).BeginTrim.Add(new TimeSpan(0, 0, 0, 0, (int)((value) / ProductionTimeLine.ScaleTime))) >= TimeSpan.Zero) |
|
25 { |
|
26 SetValue(TrimLeftProperty, value); |
|
27 ((CustomableVideoElementVM)DataContext).BeginTrim = ((CustomableVideoElementVM)DataContext).BeginTrim.Add(new TimeSpan(0, 0, 0, 0, (int)((value) / ProductionTimeLine.ScaleTime))); |
|
28 this.Width = ((CustomableVideoElementVM)DataContext).Duration ; |
|
29 } |
|
30 } |
|
31 } |
|
32 public static readonly DependencyProperty TrimLeftProperty = |
|
33 DependencyProperty.Register("TrimLeft", typeof(double), typeof(CustomableVideoElement), null); |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 public double TrimRight |
|
39 { |
|
40 get { return (double )GetValue(TrimRightProperty); } |
|
41 set |
|
42 { |
|
43 if(((CustomableVideoElementVM)DataContext).EndTrim.Add(new TimeSpan(0, 0, 0, 0, (int)((value) / ProductionTimeLine.ScaleTime))) >= TimeSpan.Zero) |
|
44 { |
|
45 SetValue(TrimRightProperty, value); |
|
46 ((CustomableVideoElementVM)DataContext).EndTrim = ((CustomableVideoElementVM)DataContext).EndTrim.Add(new TimeSpan(0, 0, 0, 0, (int)((value) / ProductionTimeLine.ScaleTime))); |
|
47 this.Width = ((CustomableVideoElementVM)DataContext).Duration; |
|
48 } |
|
49 } |
|
50 } |
|
51 |
|
52 // Using a DependencyProperty as the backing store for TrimRight. This enables animation, styling, binding, etc... |
|
53 public static readonly DependencyProperty TrimRightProperty = |
|
54 DependencyProperty.Register("TrimRight", typeof(double ), typeof(CustomableVideoElement),null); |
|
55 |
|
56 |
|
57 public CustomableVideoElement() |
|
58 { |
|
59 InitializeComponent(); |
|
60 |
|
61 |
|
62 } |
|
63 |
|
64 } |
|
65 } |