client/src/Iri.Modernisation.Data/Models/SettingsProject.cs
author totetm <>
Wed, 27 Jan 2010 10:37:39 +0100
changeset 36 b6df6fce6e5d
parent 35 43bb1b8ed555
child 39 0f2bde8fdfeb
permissions -rw-r--r--
Sync init XML download. ProductionVideo from URI source
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
30
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
     1
using System;
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
     2
using System.Net;
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
     3
using System.Windows;
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
     4
using System.Windows.Controls;
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
     5
using System.Windows.Documents;
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
     6
using System.Windows.Ink;
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
     7
using System.Windows.Input;
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
     8
using System.Windows.Media;
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
     9
using System.Windows.Media.Animation;
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    10
using System.Windows.Shapes;
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    11
using System.Collections.Generic;
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    12
using System.Threading;
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    13
namespace Iri.Modernisation.Data.Models
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    14
{
36
b6df6fce6e5d Sync init XML download.
totetm <>
parents: 35
diff changeset
    15
b6df6fce6e5d Sync init XML download.
totetm <>
parents: 35
diff changeset
    16
    
30
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    17
    /// <summary>
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    18
    /// 
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    19
    /// </summary>
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    20
    public static class SettingsProject
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    21
    {
35
43bb1b8ed555 IRIFiles Class
totetm <>
parents: 32
diff changeset
    22
        
43bb1b8ed555 IRIFiles Class
totetm <>
parents: 32
diff changeset
    23
        
36
b6df6fce6e5d Sync init XML download.
totetm <>
parents: 35
diff changeset
    24
        
b6df6fce6e5d Sync init XML download.
totetm <>
parents: 35
diff changeset
    25
30
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    26
        static public List<VideoBook> ListVideoBook { get; set; }
36
b6df6fce6e5d Sync init XML download.
totetm <>
parents: 35
diff changeset
    27
        static public List<VideoSequence> ProductionVideo { get; set; }
b6df6fce6e5d Sync init XML download.
totetm <>
parents: 35
diff changeset
    28
        static public Sync Synchronizer { get; set; }
30
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    29
        static SettingsProject()
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    30
        {
36
b6df6fce6e5d Sync init XML download.
totetm <>
parents: 35
diff changeset
    31
            Synchronizer = new Sync();
b6df6fce6e5d Sync init XML download.
totetm <>
parents: 35
diff changeset
    32
            Synchronizer.Completed += new EventHandler<EventArgs>(Synchronizer_Completed);
b6df6fce6e5d Sync init XML download.
totetm <>
parents: 35
diff changeset
    33
        }
b6df6fce6e5d Sync init XML download.
totetm <>
parents: 35
diff changeset
    34
b6df6fce6e5d Sync init XML download.
totetm <>
parents: 35
diff changeset
    35
        static void Synchronizer_Completed(object sender, EventArgs e)
b6df6fce6e5d Sync init XML download.
totetm <>
parents: 35
diff changeset
    36
        {
b6df6fce6e5d Sync init XML download.
totetm <>
parents: 35
diff changeset
    37
            if (SettingsLoaded != null)
b6df6fce6e5d Sync init XML download.
totetm <>
parents: 35
diff changeset
    38
                SettingsLoaded(sender, e);
30
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    39
        }
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    40
        /// <summary>
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    41
        /// (Télé)Chargement des données;
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    42
        /// </summary>
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    43
        /// <param name="configFileURI"></param>
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    44
        static public void Load(String configFileURI)
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    45
        {
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    46
            FactoryVideoLivre.Initialize();
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    47
            FactoryVideoLivre.FactoryReady += new EventHandler(FactoryVideoLivre_FactoryReady);
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    48
            FactoryVideoLivre.LoadXMLFile(configFileURI);
35
43bb1b8ed555 IRIFiles Class
totetm <>
parents: 32
diff changeset
    49
            
30
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    50
        }
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    51
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    52
        /// <summary>
36
b6df6fce6e5d Sync init XML download.
totetm <>
parents: 35
diff changeset
    53
        /// Une fois que le fichier config du projet est chargé
30
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    54
        /// </summary>
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    55
        /// <param name="sender"></param>
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    56
        /// <param name="e"></param>
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    57
        static void FactoryVideoLivre_FactoryReady(object sender, EventArgs e)
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    58
        {
35
43bb1b8ed555 IRIFiles Class
totetm <>
parents: 32
diff changeset
    59
            
43bb1b8ed555 IRIFiles Class
totetm <>
parents: 32
diff changeset
    60
            Loader<List<VideoBook>> loaderListVideoBook = new Loader<List<VideoBook>>(VideoBook.GetListVideoBook);
36
b6df6fce6e5d Sync init XML download.
totetm <>
parents: 35
diff changeset
    61
            
b6df6fce6e5d Sync init XML download.
totetm <>
parents: 35
diff changeset
    62
            loaderListVideoBook.LoaderFinished += new EventHandler<EventArgs>(LoaderVideoBook_LoaderFinished);
b6df6fce6e5d Sync init XML download.
totetm <>
parents: 35
diff changeset
    63
            Synchronizer.RegisterLoader(loaderListVideoBook);
b6df6fce6e5d Sync init XML download.
totetm <>
parents: 35
diff changeset
    64
            
b6df6fce6e5d Sync init XML download.
totetm <>
parents: 35
diff changeset
    65
b6df6fce6e5d Sync init XML download.
totetm <>
parents: 35
diff changeset
    66
            Loader<List<VideoSequence>> loaderProductionVideo = new Loader<List<VideoSequence>>(VideoSequence.GetProductionVideo);
35
43bb1b8ed555 IRIFiles Class
totetm <>
parents: 32
diff changeset
    67
          
36
b6df6fce6e5d Sync init XML download.
totetm <>
parents: 35
diff changeset
    68
            loaderProductionVideo.LoaderFinished += new EventHandler<EventArgs>(loaderProductionVideo_LoaderFinished);
b6df6fce6e5d Sync init XML download.
totetm <>
parents: 35
diff changeset
    69
            Synchronizer.RegisterLoader(loaderProductionVideo);
b6df6fce6e5d Sync init XML download.
totetm <>
parents: 35
diff changeset
    70
            
b6df6fce6e5d Sync init XML download.
totetm <>
parents: 35
diff changeset
    71
            loaderProductionVideo.Load(FactoryVideoLivre.ProductionVideoPath);
b6df6fce6e5d Sync init XML download.
totetm <>
parents: 35
diff changeset
    72
            loaderListVideoBook.Load(FactoryVideoLivre.VideoBookListPath);
b6df6fce6e5d Sync init XML download.
totetm <>
parents: 35
diff changeset
    73
b6df6fce6e5d Sync init XML download.
totetm <>
parents: 35
diff changeset
    74
          
b6df6fce6e5d Sync init XML download.
totetm <>
parents: 35
diff changeset
    75
        }
b6df6fce6e5d Sync init XML download.
totetm <>
parents: 35
diff changeset
    76
b6df6fce6e5d Sync init XML download.
totetm <>
parents: 35
diff changeset
    77
        static void loaderProductionVideo_LoaderFinished(object sender, EventArgs e)
b6df6fce6e5d Sync init XML download.
totetm <>
parents: 35
diff changeset
    78
        {
b6df6fce6e5d Sync init XML download.
totetm <>
parents: 35
diff changeset
    79
            SettingsProject.ProductionVideo = ((LoaderEventArgs<List<VideoSequence>>)e).CreatedObject;
b6df6fce6e5d Sync init XML download.
totetm <>
parents: 35
diff changeset
    80
    
30
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    81
        }
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    82
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    83
       
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    84
36
b6df6fce6e5d Sync init XML download.
totetm <>
parents: 35
diff changeset
    85
        static void LoaderVideoBook_LoaderFinished(object sender, EventArgs e)
30
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    86
        {
36
b6df6fce6e5d Sync init XML download.
totetm <>
parents: 35
diff changeset
    87
            SettingsProject.ListVideoBook = ((LoaderEventArgs<List<VideoBook>>)e).CreatedObject;
b6df6fce6e5d Sync init XML download.
totetm <>
parents: 35
diff changeset
    88
           
30
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    89
        }
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    90
        /// <summary>
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    91
        /// Evenement prévenant quand tout est pret
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    92
        /// </summary>
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    93
        static public event EventHandler SettingsLoaded;
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    94
    }
644e3cd48034 Introduce in Web context
totetm <>
parents:
diff changeset
    95
}