client/src/Iri.Modernisation.Controls/View/HeaderProduction/HeaderProductionChapter.xaml.cs
author totetm <>
Fri, 12 Feb 2010 16:22:57 +0100
changeset 47 9b26023b8c83
parent 38 bd33267300aa
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

using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Iri.Modernisation.Controls.ViewModel;
using Iri.Modernisation.BaseMVVM.Commands;
namespace Iri.Modernisation.Controls.View
{
	public partial class HeaderProductionChapter : UserControl
	{




            
        public bool Selected
        {
            get { return (bool)GetValue(SelectedProperty); }
            set 
            { 
                SetValue(SelectedProperty, value);
                
            }

        }

        // Using a DependencyProperty as the backing store for Selected.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty SelectedProperty =
            DependencyProperty.Register("Selected", typeof(bool), typeof(HeaderProductionChapter), new PropertyMetadata(false));



		public HeaderProductionChapter()
		{
			// Required to initialize variables
			InitializeComponent();
			 EditionController.Text = Iri.Modernisation.Lang.LangResource.EditingLabel;
             IndexController.Text = Iri.Modernisation.Lang.LangResource.IndexingLabel;
             EnrichmentController.Text = Iri.Modernisation.Lang.LangResource.EnrichmentLabel;
            // Commands.ActivePart.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(ActivePart_Executed);
             EditionController.HeaderProductionPartFinished += new EventHandler<HeaderProductionPartControlerEventArgs>(EditionController_HeaderProductionPartFinished);
             IndexController.HeaderProductionPartFinished += new EventHandler<HeaderProductionPartControlerEventArgs>(IndexController_HeaderProductionPartFinished);

             EditionController.Clicked += new EventHandler(EditionController_Clicked);
             IndexController.Clicked += new EventHandler(IndexController_Clicked);
             Commands.HeaderProduction.IndexFinishedOk.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(IndexFinishedOk_Executed);
             Commands.HeaderProduction.EditFinishedOk.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(EditFinishedOk_Executed);
        }

        void IndexFinishedOk_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
        {
            if (DataContext == e.Source)
                IndexController.Finish();
        }

        void EditFinishedOk_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
        {
            if(DataContext == e.Source)
            EditionController.Finish();
        }

        void IndexController_Clicked(object sender, EventArgs e)
        {
            ((HeaderProductionChapterVM)DataContext).IndexClick();
        }

      

        void EditionController_Clicked(object sender, EventArgs e)
        {
            ((HeaderProductionChapterVM)DataContext).EditClick();
        }

        void IndexController_HeaderProductionPartFinished(object sender, HeaderProductionPartControlerEventArgs e)
        {
            ((HeaderProductionChapterVM)DataContext).Indexing = true;
            VisualStateManager.GoToState(EnrichmentController, "Finished", true);
        }

        void EditionController_HeaderProductionPartFinished(object sender, HeaderProductionPartControlerEventArgs e)
        {
            ((HeaderProductionChapterVM)DataContext).Editing = true;
         
        }
      
        
    
	}
}