client/src/Iri.Modernisation.Data/Models/Sync.cs
author totetm <>
Fri, 12 Feb 2010 16:22:57 +0100
changeset 47 9b26023b8c83
parent 36 b6df6fce6e5d
permissions -rw-r--r--
Fixed| bug si on ferme un livre en le lisant ReFixed|faire fonctionner le seek, même quand play n'est pas activer
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
36
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
     1
using System;
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
     2
using System.Net;
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
     3
using System.Windows;
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
     4
using System.Windows.Controls;
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
     5
using System.Windows.Documents;
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
     6
using System.Windows.Ink;
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
     7
using System.Windows.Input;
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
     8
using System.Windows.Media;
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
     9
using System.Windows.Media.Animation;
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    10
using System.Windows.Shapes;
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    11
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    12
namespace Iri.Modernisation.Data.Models
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    13
{
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    14
    /// <summary>
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    15
    /// Classe servant à synchroniser les Loaders
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    16
    /// On créé la classe, on enregistre les Loader a synchroniser.
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    17
    /// /* Utilisation */
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    18
    /// Attention /!\ Il faut enregistrer le loader APRES s'êtres abonnée à son event LoaderFinished.
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    19
    /// </summary>
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    20
    public class Sync
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    21
    {
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    22
        /// <summary>
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    23
        /// Constructeur par défaut
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    24
        /// </summary>
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    25
        public Sync()
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    26
        { _registeredLoader = 0; }
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    27
        private int _registeredLoader { get; set; }
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    28
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    29
        /// <summary>
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    30
        /// Méthode permettant d'enregistrer les Loader au sein d'un même Sync
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    31
        /// </summary>
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    32
        /// <param name="loader">Loader à enregistrer</param>
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    33
        public void RegisterLoader(ILoader loader)
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    34
        {
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    35
            _registeredLoader++;
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    36
            loader.LoaderFinished += new EventHandler<EventArgs>(loader_LoaderFinished);
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    37
        }
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    38
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    39
        private void loader_LoaderFinished(object sender, EventArgs e)
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    40
        {
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    41
            _registeredLoader--;
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    42
            if (_registeredLoader == 0)
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    43
            {
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    44
                Completed(this, new EventArgs());
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    45
            }
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    46
        }
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    47
      
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    48
        /// <summary>
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    49
        /// Evenement déclanché une fois tous les Loader fini
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    50
        /// </summary>
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    51
        public event EventHandler<EventArgs> Completed;
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    52
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    53
    }
b6df6fce6e5d Sync init XML download.
totetm <>
parents:
diff changeset
    54
}