|
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 SLExtensions.Input; |
|
|
12 |
using Iri.Modernisation.BaseMVVM.Commands; |
|
|
13 |
using Iri.Modernisation.BaseMVVM.ViewModel; |
|
|
14 |
using Iri.Modernisation.Data.Models; |
|
|
15 |
using System.Collections.Generic; |
|
|
16 |
using System.Linq; |
|
|
17 |
namespace Iri.Modernisation.Controls.ViewModel |
|
|
18 |
{ |
|
|
19 |
public class ChutierVM : BaseMVVM.ViewModel.ViewModel |
|
|
20 |
{ |
|
|
21 |
protected List<PolemicElement> _annotations = new List<PolemicElement>(); |
|
|
22 |
protected List<PolemicElement> list = new List<PolemicElement>(); |
|
|
23 |
public List<PolemicElement> Annotations |
|
|
24 |
{ |
|
|
25 |
get |
|
|
26 |
{ |
|
|
27 |
if (SearchWord != String.Empty) |
|
|
28 |
{ |
|
|
29 |
return list; |
|
|
30 |
} |
|
|
31 |
else |
|
|
32 |
{ |
|
|
33 |
return _annotations; |
|
|
34 |
} |
|
|
35 |
|
|
|
36 |
} |
|
|
37 |
set |
|
|
38 |
{ |
|
|
39 |
list = value; |
|
|
40 |
OnPropertyChanged("Annotations"); |
|
|
41 |
} |
|
|
42 |
} |
|
|
43 |
protected String _searchWord = ""; |
|
|
44 |
public String SearchWord |
|
|
45 |
{ |
|
|
46 |
get |
|
|
47 |
{ |
|
|
48 |
return _searchWord; |
|
|
49 |
} |
|
|
50 |
|
|
|
51 |
set |
|
|
52 |
{ |
|
|
53 |
_searchWord = value; |
|
|
54 |
OnPropertyChanged("SearchWord"); |
|
|
55 |
|
|
|
56 |
} |
|
|
57 |
} |
|
|
58 |
public ChutierVM() |
|
|
59 |
{ |
|
|
60 |
InitializeCommands(); |
|
|
61 |
} |
|
|
62 |
|
|
|
63 |
private void InitializeCommands() |
|
|
64 |
{ |
|
|
65 |
} |
|
|
66 |
|
|
|
67 |
public ChutierVM(List<PolemicElement> argList) |
|
|
68 |
{ |
|
|
69 |
_annotations = argList; |
|
|
70 |
InitializeCommands(); |
|
|
71 |
} |
|
|
72 |
|
|
|
73 |
protected void Search() |
|
|
74 |
{ |
|
|
75 |
var query = from c in _annotations |
|
|
76 |
where c.Title.Contains(_searchWord) |
|
|
77 |
select c; |
|
|
78 |
Annotations = query.ToList(); |
|
|
79 |
} |
|
|
80 |
public void ClickAnnotation_Executed(object sender, ExecutedEventArgs e) |
|
|
81 |
{ |
|
|
82 |
Annotation VB = (Annotation)e.Parameter; |
|
|
83 |
MessageBox.Show(VB.Contributer.UserName + " - " + VB.Title); |
|
|
84 |
} |
|
|
85 |
|
|
|
86 |
public void ChutierSearch_Executed(object sender, ExecutedEventArgs e) |
|
|
87 |
{ |
|
|
88 |
Search(); |
|
|
89 |
|
|
|
90 |
} |
|
|
91 |
|
|
|
92 |
} |
|
|
93 |
public class PersonnalChutierVM : ChutierVM |
|
|
94 |
{ |
|
|
95 |
public PersonnalChutierVM(List<PolemicElement> argList) |
|
|
96 |
: base( argList) |
|
|
97 |
{ |
|
|
98 |
InitializeCommands(); |
|
|
99 |
} |
|
|
100 |
|
|
|
101 |
private void InitializeCommands() |
|
|
102 |
{ |
|
|
103 |
Commands.PersonnalChutier.Search.Executed += new EventHandler<ExecutedEventArgs>(ChutierSearch_Executed); |
|
|
104 |
Commands.PersonnalChutier.ClickAnnotation.Executed += new EventHandler<ExecutedEventArgs>(ClickAnnotation_Executed); |
|
|
105 |
} |
|
|
106 |
|
|
|
107 |
|
|
|
108 |
} |
|
|
109 |
|
|
|
110 |
public class ReferencesChutierVM : ChutierVM |
|
|
111 |
{ |
|
|
112 |
public ReferencesChutierVM(List<PolemicElement> argList) |
|
|
113 |
: base(argList) |
|
|
114 |
{ |
|
|
115 |
InitializeCommands(); |
|
|
116 |
} |
|
|
117 |
|
|
|
118 |
private void InitializeCommands() |
|
|
119 |
{ |
|
|
120 |
Commands.ReferencesChutier.Search.Executed += new EventHandler<ExecutedEventArgs>(ChutierSearch_Executed); |
|
|
121 |
Commands.ReferencesChutier.ClickAnnotation.Executed += new EventHandler<ExecutedEventArgs>(ClickAnnotation_Executed); |
|
|
122 |
} |
|
|
123 |
|
|
|
124 |
|
|
|
125 |
} |
|
|
126 |
|
|
|
127 |
} |