|
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 System.Collections.Generic; |
|
|
12 |
using Iri.Modernisation.Data.Models; |
|
|
13 |
using Iri.Modernisation.Data.LDTClass; |
|
|
14 |
using Iri.Modernisation.BaseMVVM.Commands; |
|
|
15 |
using Iri.Modernisation.BaseMVVM.ViewModel; |
|
|
16 |
namespace Iri.Modernisation.Controls.ViewModel |
|
|
17 |
{ |
|
|
18 |
public class ConsultationViewVM : BaseMVVM.ViewModel.ViewModel |
|
|
19 |
{ |
|
|
20 |
private PolemicElement _selectedElement; |
|
|
21 |
public PolemicElement SelectedElement |
|
|
22 |
{ |
|
|
23 |
get |
|
|
24 |
{ |
|
|
25 |
return _selectedElement; |
|
|
26 |
} |
|
|
27 |
set |
|
|
28 |
{ |
|
|
29 |
_selectedElement = value; |
|
|
30 |
OnPropertyChanged("SelectedElement"); |
|
|
31 |
} |
|
|
32 |
} |
|
|
33 |
|
|
|
34 |
|
|
|
35 |
|
|
|
36 |
private SLExtensions.Collections.ObjectModel.ObservableCollection<BookTimeLineVM> _selectedVideoBooks; |
|
|
37 |
public SLExtensions.Collections.ObjectModel.ObservableCollection<BookTimeLineVM> SelectedVideoBooks |
|
|
38 |
{ |
|
|
39 |
get |
|
|
40 |
{ |
|
|
41 |
|
|
|
42 |
return _selectedVideoBooks; |
|
|
43 |
} |
|
|
44 |
set |
|
|
45 |
{ |
|
|
46 |
_selectedVideoBooks = value; |
|
|
47 |
OnPropertyChanged("SelectedVideoBooks"); |
|
|
48 |
} |
|
|
49 |
} |
|
|
50 |
|
|
|
51 |
private int _selectedVideoBookIndex=-1; |
|
|
52 |
public int SelectedVideoBookIndex |
|
|
53 |
{ |
|
|
54 |
get |
|
|
55 |
{ |
|
|
56 |
return _selectedVideoBookIndex; |
|
|
57 |
} |
|
|
58 |
set |
|
|
59 |
{ |
|
|
60 |
_selectedVideoBookIndex= value; |
|
|
61 |
OnPropertyChanged("SelectedVideoBookIndex"); |
|
|
62 |
ConsultationBookViewContextMenu.SelectedBookVM = (_selectedVideoBooks[value]); |
|
|
63 |
|
|
|
64 |
} |
|
|
65 |
} |
|
|
66 |
|
|
|
67 |
private ConsultationBookViewVM _consultationBookViewContextMenu; |
|
|
68 |
public ConsultationBookViewVM ConsultationBookViewContextMenu |
|
|
69 |
{ |
|
|
70 |
get |
|
|
71 |
{ |
|
|
72 |
return _consultationBookViewContextMenu; |
|
|
73 |
} |
|
|
74 |
set |
|
|
75 |
{ |
|
|
76 |
_consultationBookViewContextMenu = value; |
|
|
77 |
OnPropertyChanged(null); |
|
|
78 |
} |
|
|
79 |
} |
|
|
80 |
|
|
|
81 |
private void InitializeCommands() |
|
|
82 |
{ |
|
|
83 |
Commands.ConsultMenu.ClickBook.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(ClickBook_Executed); |
|
|
84 |
Commands.PolemicElement.SelectPolemicElement.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(SelectPolemicElement_Executed); |
|
|
85 |
|
|
|
86 |
Commands.ClickMenu.CreateNewTextualAnnotation.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(CreateNewTextualAnnotation_Executed); |
|
|
87 |
} |
|
|
88 |
|
|
|
89 |
void ClickBook_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e) |
|
|
90 |
{ |
|
|
91 |
BookTimeLineVM temp = new BookTimeLineVM((VideoBook)e.Parameter); |
|
23
|
92 |
temp.ViewModelVideoViewer = ConsultationBookViewContextMenu.ActualVideoSourceVM; |
|
0
|
93 |
bool CanAdd = true; |
|
|
94 |
foreach(BookTimeLineVM BookTLVM in SelectedVideoBooks) |
|
|
95 |
{ |
|
|
96 |
if (BookTLVM.SelectedBook == (VideoBook)e.Parameter) |
|
|
97 |
{ |
|
|
98 |
CanAdd = false; |
|
|
99 |
} |
|
|
100 |
} |
|
|
101 |
if(CanAdd) |
|
|
102 |
{ |
|
|
103 |
SelectedVideoBooks.Add(temp); |
|
|
104 |
} |
|
|
105 |
|
|
|
106 |
} |
|
|
107 |
|
|
|
108 |
|
|
|
109 |
private AnnotationMakerVM _annotationMakerVM; |
|
|
110 |
public AnnotationMakerVM ViewModelAnnotationMaker |
|
|
111 |
{ |
|
|
112 |
get |
|
|
113 |
{ |
|
|
114 |
return _annotationMakerVM; |
|
|
115 |
} |
|
|
116 |
} |
|
|
117 |
void CreateNewTextualAnnotation_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e) |
|
|
118 |
{ |
|
|
119 |
ViewModelAnnotationMaker.RefElement = SelectedElement; |
|
|
120 |
} |
|
|
121 |
public ConsultationViewVM() |
|
|
122 |
{ |
|
|
123 |
InitializeCommands(); |
|
|
124 |
_consultationBookViewContextMenu = new ConsultationBookViewVM(); |
|
|
125 |
_annotationMakerVM = new AnnotationMakerVM(); |
|
|
126 |
SelectedVideoBooks = new SLExtensions.Collections.ObjectModel.ObservableCollection<BookTimeLineVM>(); |
|
|
127 |
} |
|
|
128 |
|
|
|
129 |
void SelectPolemicElement_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e) |
|
|
130 |
{ |
|
|
131 |
SelectedElement= (PolemicElement)e.Parameter; |
|
|
132 |
try |
|
|
133 |
{ |
|
|
134 |
ConsultationBookViewContextMenu.SelectedIndex = (SegmentIndex)SelectedElement; |
|
|
135 |
} |
|
|
136 |
catch |
|
|
137 |
{ |
|
|
138 |
} |
|
|
139 |
|
|
|
140 |
|
|
|
141 |
|
|
|
142 |
} |
|
|
143 |
} |
|
|
144 |
} |