10 using System.Windows.Shapes; |
10 using System.Windows.Shapes; |
11 using System.Collections.Generic; |
11 using System.Collections.Generic; |
12 using System.Threading; |
12 using System.Threading; |
13 namespace Iri.Modernisation.Data.Models |
13 namespace Iri.Modernisation.Data.Models |
14 { |
14 { |
|
15 |
|
16 |
15 /// <summary> |
17 /// <summary> |
16 /// |
18 /// |
17 /// </summary> |
19 /// </summary> |
18 public static class SettingsProject |
20 public static class SettingsProject |
19 { |
21 { |
20 |
22 |
21 |
23 |
|
24 |
|
25 |
22 static public List<VideoBook> ListVideoBook { get; set; } |
26 static public List<VideoBook> ListVideoBook { get; set; } |
23 |
27 static public List<VideoSequence> ProductionVideo { get; set; } |
|
28 static public Sync Synchronizer { get; set; } |
24 static SettingsProject() |
29 static SettingsProject() |
25 { |
30 { |
26 //_internalDictionary.Add(new Loader<List<VideoBook>>(VideoBook.GetListVideoBook), |
31 Synchronizer = new Sync(); |
27 // new KeyValuePair<string, object>("", null)); |
32 Synchronizer.Completed += new EventHandler<EventArgs>(Synchronizer_Completed); |
|
33 } |
|
34 |
|
35 static void Synchronizer_Completed(object sender, EventArgs e) |
|
36 { |
|
37 if (SettingsLoaded != null) |
|
38 SettingsLoaded(sender, e); |
28 } |
39 } |
29 /// <summary> |
40 /// <summary> |
30 /// (Télé)Chargement des données; |
41 /// (Télé)Chargement des données; |
31 /// </summary> |
42 /// </summary> |
32 /// <param name="configFileURI"></param> |
43 /// <param name="configFileURI"></param> |
37 FactoryVideoLivre.LoadXMLFile(configFileURI); |
48 FactoryVideoLivre.LoadXMLFile(configFileURI); |
38 |
49 |
39 } |
50 } |
40 |
51 |
41 /// <summary> |
52 /// <summary> |
42 /// |
53 /// Une fois que le fichier config du projet est chargé |
43 /// </summary> |
54 /// </summary> |
44 /// <param name="sender"></param> |
55 /// <param name="sender"></param> |
45 /// <param name="e"></param> |
56 /// <param name="e"></param> |
46 static void FactoryVideoLivre_FactoryReady(object sender, EventArgs e) |
57 static void FactoryVideoLivre_FactoryReady(object sender, EventArgs e) |
47 { |
58 { |
48 |
59 |
49 Loader<List<VideoBook>> loaderListVideoBook = new Loader<List<VideoBook>>(VideoBook.GetListVideoBook); |
60 Loader<List<VideoBook>> loaderListVideoBook = new Loader<List<VideoBook>>(VideoBook.GetListVideoBook); |
50 loaderListVideoBook.LoaderFinished += new EventHandler<LoaderEventArgs<List<VideoBook>>>(LoaderVideoBook_LoaderFinished); |
61 |
51 loaderListVideoBook.Load(FactoryVideoLivre.VideoBookListPath); |
62 loaderListVideoBook.LoaderFinished += new EventHandler<EventArgs>(LoaderVideoBook_LoaderFinished); |
52 // VideoBookLoaderHelper LoaderVideoBook = new VideoBookLoaderHelper(FactoryVideoLivre.VideoBookListPath); |
63 Synchronizer.RegisterLoader(loaderListVideoBook); |
53 // LoaderVideoBook.LoaderFinished += new EventHandler<LoaderEventArgs<List<VideoBook>>>(LoaderVideoBook_LoaderFinished); |
64 |
|
65 |
|
66 Loader<List<VideoSequence>> loaderProductionVideo = new Loader<List<VideoSequence>>(VideoSequence.GetProductionVideo); |
54 |
67 |
|
68 loaderProductionVideo.LoaderFinished += new EventHandler<EventArgs>(loaderProductionVideo_LoaderFinished); |
|
69 Synchronizer.RegisterLoader(loaderProductionVideo); |
|
70 |
|
71 loaderProductionVideo.Load(FactoryVideoLivre.ProductionVideoPath); |
|
72 loaderListVideoBook.Load(FactoryVideoLivre.VideoBookListPath); |
|
73 |
|
74 |
|
75 } |
|
76 |
|
77 static void loaderProductionVideo_LoaderFinished(object sender, EventArgs e) |
|
78 { |
|
79 SettingsProject.ProductionVideo = ((LoaderEventArgs<List<VideoSequence>>)e).CreatedObject; |
|
80 |
55 } |
81 } |
56 |
82 |
57 |
83 |
58 |
84 |
59 static void LoaderVideoBook_LoaderFinished(object sender, LoaderEventArgs<List<VideoBook>> e) |
85 static void LoaderVideoBook_LoaderFinished(object sender, EventArgs e) |
60 { |
86 { |
61 SettingsProject.ListVideoBook = e.CreatedObject; |
87 SettingsProject.ListVideoBook = ((LoaderEventArgs<List<VideoBook>>)e).CreatedObject; |
62 if (SettingsLoaded != null) |
88 |
63 SettingsLoaded(sender, e); |
|
64 } |
89 } |
65 /// <summary> |
90 /// <summary> |
66 /// Evenement prévenant quand tout est pret |
91 /// Evenement prévenant quand tout est pret |
67 /// </summary> |
92 /// </summary> |
68 static public event EventHandler SettingsLoaded; |
93 static public event EventHandler SettingsLoaded; |