| author | totetm <> |
| Fri, 12 Feb 2010 16:22:57 +0100 | |
| changeset 47 | 9b26023b8c83 |
| parent 38 | bd33267300aa |
| permissions | -rw-r--r-- |
| 0 | 1 |
using System; |
2 |
using System.Net; |
|
3 |
using System.Windows; |
|
4 |
using System.Windows.Controls; |
|
5 |
using System.Windows.Documents; |
|
6 |
using System.Windows.Ink; |
|
7 |
using System.Windows.Input; |
|
8 |
using System.Windows.Media; |
|
9 |
using System.Windows.Media.Animation; |
|
10 |
using System.Windows.Shapes; |
|
11 |
using Iri.Modernisation.BaseMVVM.Commands; |
|
12 |
using Iri.Modernisation.BaseMVVM.ViewModel; |
|
13 |
namespace Iri.Modernisation.Controls.ViewModel |
|
14 |
{ |
|
15 |
public class VideoViewerVM : BaseMVVM.ViewModel.ViewModel |
|
16 |
{ |
|
17 |
||
18 |
private String _source; |
|
19 |
public String Source |
|
20 |
{ |
|
21 |
get |
|
22 |
{ |
|
23 |
return _source; |
|
24 |
} |
|
25 |
set |
|
26 |
{ |
|
27 |
_source = value; |
|
28 |
|
|
29 |
OnPropertyChanged(null); |
|
30 |
} |
|
31 |
} |
|
32 |
public Uri USource |
|
33 |
{ |
|
34 |
get |
|
35 |
{ |
|
36 |
if (Source != null) |
|
37 |
{ |
|
38 |
return new Uri(Source, UriKind.RelativeOrAbsolute); |
|
39 |
} |
|
40 |
else |
|
41 |
{ |
|
42 |
return null; |
|
43 |
} |
|
44 |
} |
|
45 |
||
46 |
} |
|
| 15 | 47 |
|
| 0 | 48 |
public String Info |
49 |
{ |
|
50 |
get |
|
51 |
{ |
|
52 |
return position + ":" + Source; |
|
53 |
} |
|
54 |
|
|
55 |
} |
|
| 15 | 56 |
|
| 0 | 57 |
private TimeSpan position = new TimeSpan(0,0,0); |
58 |
public TimeSpan Position |
|
59 |
{ |
|
60 |
get |
|
61 |
{ |
|
62 |
return position; |
|
63 |
} |
|
64 |
set |
|
65 |
{ |
|
66 |
position = value; |
|
67 |
//OnPropertyChanged("Position"); |
|
68 |
OnPropertyChanged("Info"); |
|
69 |
|
|
70 |
} |
|
71 |
} |
|
| 15 | 72 |
|
73 |
private bool _playControl; |
|
74 |
public bool PlayControl |
|
75 |
{ |
|
76 |
get |
|
77 |
{ |
|
78 |
return _playControl; |
|
79 |
} |
|
80 |
set |
|
81 |
{ |
|
82 |
_playControl = value; |
|
83 |
OnPropertyChanged("PlayControl"); |
|
84 |
} |
|
85 |
} |
|
86 |
||
87 |
private bool _recordControl; |
|
88 |
public bool RecordControl |
|
89 |
{ |
|
90 |
get |
|
91 |
{ |
|
92 |
return _recordControl; |
|
93 |
} |
|
94 |
set |
|
95 |
{ |
|
96 |
_recordControl = value; |
|
97 |
OnPropertyChanged("RecordControl"); |
|
98 |
} |
|
99 |
} |
|
| 25 | 100 |
|
101 |
private bool _autoPlay; |
|
102 |
public bool AutoPlay |
|
103 |
{ |
|
104 |
get |
|
105 |
{ |
|
106 |
return _autoPlay; |
|
107 |
} |
|
108 |
set |
|
109 |
{ |
|
110 |
_autoPlay = value; |
|
111 |
OnPropertyChanged("AutoPlay"); |
|
112 |
} |
|
113 |
||
114 |
} |
|
115 |
||
| 15 | 116 |
public VideoViewerVM(bool playControl,bool recordControl ) |
117 |
{ |
|
118 |
_playControl = playControl; |
|
119 |
_recordControl = recordControl; |
|
120 |
InitializeCommands(); |
|
| 25 | 121 |
AutoPlay = false; |
122 |
|
|
| 15 | 123 |
} |
| 29 | 124 |
|
| 36 | 125 |
public TimeSpan BeginIn { get; set; } |
| 22 | 126 |
public event EventHandler<VideoViewerVMEventArgs> Tick; |
127 |
||
| 15 | 128 |
private void InitializeCommands() |
| 0 | 129 |
{ |
| 22 | 130 |
|
| 0 | 131 |
} |
|
23
10acb6a11a73
Update VideoViewer ( Allow Multi-VideoViewer)
Matthieu Totet
parents:
22
diff
changeset
|
132 |
public void GoTo(TimeSpan pos) |
|
10acb6a11a73
Update VideoViewer ( Allow Multi-VideoViewer)
Matthieu Totet
parents:
22
diff
changeset
|
133 |
{ |
|
10acb6a11a73
Update VideoViewer ( Allow Multi-VideoViewer)
Matthieu Totet
parents:
22
diff
changeset
|
134 |
Position = pos; |
|
10acb6a11a73
Update VideoViewer ( Allow Multi-VideoViewer)
Matthieu Totet
parents:
22
diff
changeset
|
135 |
Commands.GoToTime.Execute(Position,this); |
|
10acb6a11a73
Update VideoViewer ( Allow Multi-VideoViewer)
Matthieu Totet
parents:
22
diff
changeset
|
136 |
} |
| 25 | 137 |
public void Pause() |
138 |
{ |
|
139 |
Commands.VideoViewer.Pause.Execute(null, this); |
|
140 |
} |
|
| 35 | 141 |
public void Play() |
142 |
{ |
|
143 |
Commands.VideoViewer.Play.Execute(this, this); |
|
144 |
} |
|
| 22 | 145 |
public void LaunchTick(TimeSpan Pos) |
| 0 | 146 |
{ |
| 22 | 147 |
if(Tick!=null) |
148 |
{ |
|
| 36 | 149 |
Tick(this, new VideoViewerVMEventArgs(Pos-BeginIn)); |
| 22 | 150 |
} |
| 0 | 151 |
} |
152 |
||
| 38 | 153 |
private bool _isPlayed; |
154 |
public bool IsPLayed |
|
155 |
{ |
|
156 |
get |
|
157 |
{ |
|
158 |
return _isPlayed; |
|
159 |
} |
|
160 |
set |
|
161 |
{ |
|
162 |
_isPlayed = value; |
|
163 |
OnPropertyChanged("IsPlayed"); |
|
164 |
} |
|
165 |
} |
|
| 0 | 166 |
} |
| 22 | 167 |
public class VideoViewerVMEventArgs : EventArgs |
168 |
{ |
|
|
23
10acb6a11a73
Update VideoViewer ( Allow Multi-VideoViewer)
Matthieu Totet
parents:
22
diff
changeset
|
169 |
public TimeSpan Position { get; set; } |
| 22 | 170 |
public VideoViewerVMEventArgs(TimeSpan pos) |
171 |
{ |
|
172 |
Position = pos; |
|
173 |
} |
|
174 |
} |
|
| 0 | 175 |
} |