|
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.Data.Models; |
|
|
12 |
using Iri.Modernisation.BaseMVVM.Commands; |
|
|
13 |
using Iri.Modernisation.BaseMVVM.ViewModel; |
|
26
|
14 |
using System.Collections.Generic; |
|
0
|
15 |
namespace Iri.Modernisation.Controls.ViewModel |
|
|
16 |
{ |
|
|
17 |
public class HeaderProductionVM : BaseMVVM.ViewModel.ViewModel |
|
|
18 |
{ |
|
26
|
19 |
|
|
27
|
20 |
private List<HeaderProductionChapterVM> _productionChapters; |
|
|
21 |
public List<HeaderProductionChapterVM> ProductionChapters |
|
0
|
22 |
{ |
|
|
23 |
get |
|
|
24 |
{ |
|
27
|
25 |
return _productionChapters; |
|
0
|
26 |
} |
|
|
27 |
set |
|
|
28 |
{ |
|
27
|
29 |
_productionChapters = value; |
|
|
30 |
OnPropertyChanged("ProductionChapters"); |
|
0
|
31 |
} |
|
|
32 |
} |
|
|
33 |
|
|
27
|
34 |
private HeaderProductionChapterVM _selectedChapter; |
|
|
35 |
public HeaderProductionChapterVM SelectedChapter |
|
0
|
36 |
{ |
|
|
37 |
get |
|
|
38 |
{ |
|
27
|
39 |
return _selectedChapter; |
|
0
|
40 |
} |
|
27
|
41 |
set |
|
|
42 |
{ |
|
|
43 |
if (_selectedChapter != null) |
|
|
44 |
{ |
|
|
45 |
_selectedChapter.HighLight = false; |
|
|
46 |
} |
|
|
47 |
|
|
|
48 |
_selectedChapter = value; |
|
|
49 |
|
|
|
50 |
value.HighLight = true; |
|
|
51 |
if (Change != null) |
|
|
52 |
Change(this, new HeaderProductionVMArgs(SelectedChapter)); |
|
|
53 |
|
|
|
54 |
|
|
|
55 |
OnPropertyChanged("SelectedChapter"); |
|
0
|
56 |
} |
|
27
|
57 |
|
|
0
|
58 |
} |
|
27
|
59 |
|
|
0
|
60 |
public bool IsVideoBookComplete |
|
|
61 |
{ |
|
|
62 |
get |
|
|
63 |
{ |
|
27
|
64 |
bool test = true; |
|
|
65 |
foreach(HeaderProductionChapterVM Hpcvm in ProductionChapters ) |
|
|
66 |
{ |
|
|
67 |
test = Hpcvm.Indexing && test; |
|
|
68 |
} |
|
|
69 |
return test; |
|
0
|
70 |
} |
|
|
71 |
} |
|
25
|
72 |
private String _instruction; |
|
|
73 |
/// <summary> |
|
|
74 |
/// Instruction |
|
|
75 |
/// </summary> |
|
0
|
76 |
public String Instruction |
|
|
77 |
{ |
|
|
78 |
get |
|
|
79 |
{ |
|
|
80 |
return _instruction; |
|
|
81 |
} |
|
|
82 |
set |
|
|
83 |
{ |
|
|
84 |
_instruction = value; |
|
|
85 |
OnPropertyChanged("Instruction"); |
|
|
86 |
} |
|
|
87 |
} |
|
|
88 |
public HeaderProductionVM() |
|
|
89 |
{ |
|
27
|
90 |
_productionChapters = new List<HeaderProductionChapterVM>(); |
|
|
91 |
HeaderProductionChapterVM temp = null; |
|
|
92 |
foreach (VideoChapterDescription Vcd in FactoryVideoLivre.VideoChapterDescriptions) |
|
|
93 |
{ |
|
|
94 |
temp = new HeaderProductionChapterVM(Vcd); |
|
|
95 |
temp.Ended +=new HeaderProductionChapterVM.EndedDelegate(temp_Ended); |
|
|
96 |
temp.EditEnded += new HeaderProductionChapterVM.EditEndedDelegate(temp_EditEnded); |
|
|
97 |
temp.HighLight = false; |
|
|
98 |
_productionChapters.Add(temp); |
|
|
99 |
if(_productionChapters.Count > 1) |
|
|
100 |
{ |
|
|
101 |
_productionChapters[_productionChapters.Count - 2].EditEnded+=new HeaderProductionChapterVM.EditEndedDelegate(temp.Enable); |
|
|
102 |
|
|
|
103 |
} |
|
|
104 |
|
|
|
105 |
|
|
|
106 |
} |
|
0
|
107 |
_instruction = Iri.Modernisation.Controls.Resources.HeaderProduction.InstructionTextRessource.Introduction; |
|
27
|
108 |
|
|
|
109 |
InitializeCommands(); |
|
|
110 |
ProductionChapters[0].Enable(); |
|
|
111 |
|
|
|
112 |
|
|
|
113 |
} |
|
0
|
114 |
|
|
27
|
115 |
void temp_EditEnded() |
|
|
116 |
{ |
|
|
117 |
if(Change!=null) |
|
|
118 |
Change(this,new HeaderProductionVMArgs(SelectedChapter)); |
|
|
119 |
} |
|
|
120 |
|
|
|
121 |
|
|
|
122 |
|
|
|
123 |
void temp_Ended() |
|
|
124 |
{ |
|
|
125 |
OnPropertyChanged("IsVideoBookComplete"); |
|
|
126 |
if (Change != null) |
|
|
127 |
Change(this, new HeaderProductionVMArgs(SelectedChapter)); |
|
25
|
128 |
} |
|
0
|
129 |
private void InitializeCommands() |
|
|
130 |
{ |
|
|
131 |
} |
|
27
|
132 |
public event EventHandler<HeaderProductionVMArgs> Change; |
|
|
133 |
|
|
|
134 |
|
|
|
135 |
} |
|
|
136 |
public class HeaderProductionVMArgs : EventArgs |
|
|
137 |
{ |
|
|
138 |
|
|
|
139 |
public HeaderProductionChapterVM ChapterHeader { get; private set; } |
|
0
|
140 |
|
|
27
|
141 |
public HeaderProductionVMArgs( HeaderProductionChapterVM chapterHeader) |
|
0
|
142 |
{ |
|
27
|
143 |
ChapterHeader = chapterHeader; |
|
|
144 |
|
|
0
|
145 |
|
|
27
|
146 |
|
|
0
|
147 |
} |
|
|
148 |
} |
|
|
149 |
} |