client/src/Iri.Modernisation.Controls/View/ProductionTimeLine/ProductionTimeLine.xaml.cs
changeset 24 c031f1132dde
parent 23 10acb6a11a73
child 27 f292db96b050
equal deleted inserted replaced
23:10acb6a11a73 24:c031f1132dde
     9 using System.Windows.Shapes;
     9 using System.Windows.Shapes;
    10 using Iri.Modernisation.BaseMVVM.Commands;
    10 using Iri.Modernisation.BaseMVVM.Commands;
    11 using Iri.Modernisation.Data.Models;
    11 using Iri.Modernisation.Data.Models;
    12 using Iri.Modernisation.Controls.ViewModel;
    12 using Iri.Modernisation.Controls.ViewModel;
    13 using System.Collections.ObjectModel;
    13 using System.Collections.ObjectModel;
       
    14 using System.Globalization;
    14 namespace Iri.Modernisation.Controls.View
    15 namespace Iri.Modernisation.Controls.View
    15 {
    16 {
    16   
    17   
    17 	public partial class ProductionTimeLine : UserControl
    18 	public partial class ProductionTimeLine : UserControl
    18 	{
    19 	{
    19         public static double ScaleTime
    20         public static double ScaleTime
    20         {
    21         {
    21             get
    22             get
    22             {
    23             {
    23                 return 0.0001;
    24                 return 0.0002;
    24             }
    25             }
    25         }
    26         }
    26 		public ProductionTimeLine()
    27 		public ProductionTimeLine()
    27 		{
    28 		{
    28 			// Required to initialize variables
    29 			// Required to initialize variables
    29 			InitializeComponent();
    30 			InitializeComponent();
    30             Commands.ProductionTimeLine.EditorPartSelected.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(EditorPartSelected_Executed);
    31             Commands.ProductionTimeLine.EditorPartSelected.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(EditorPartSelected_Executed);
    31             Commands.ProductionView.VideoRecordUpdated.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(VideoRecordUpdated_Executed);
    32             Commands.ProductionView.VideoRecordUpdated.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(VideoRecordUpdated_Executed);
    32             Commands.Action.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(Action_Executed);
    33             Commands.Action.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(Action_Executed);
    33           
    34             TimeSlider.MouseLeftButtonUp += new MouseButtonEventHandler(TimeSlider_MouseLeftButtonUp);
       
    35             //TimeSlider.ValueChanged += new RoutedPropertyChangedEventHandler<double>(TimeSlider_ValueChanged);
       
    36             TimeSlider.Maximum = TimeSlider.ActualWidth / ProductionTimeLine.ScaleTime;
    34 		}
    37 		}
       
    38 
       
    39         void TimeSlider_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
       
    40         {
       
    41             Commands.TimeChange.Execute(TimeSlider.Value,DataContext);
       
    42         }
       
    43 
       
    44         void TimeSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
       
    45         {
       
    46             DeleteSequenceButton.Content = TimeSpan.FromMilliseconds(TimeSlider.Value);
       
    47            
       
    48         }
    35 
    49 
    36         void EditorPartSelected_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
    50         void EditorPartSelected_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
    37         {
    51         {
    38             UpdateElements();
    52             UpdateElements();
    39         }
    53         }
    49             AddSequenceButton.Content = ((MouseEventArgs)e.Parameter).GetPosition(this).X;
    63             AddSequenceButton.Content = ((MouseEventArgs)e.Parameter).GetPosition(this).X;
    50         }
    64         }
    51         private double _sumOfLengh=0;
    65         private double _sumOfLengh=0;
    52         public void UpdateElements()
    66         public void UpdateElements()
    53         {
    67         {
       
    68             TimeSlider.Maximum = TimeSlider.ActualWidth / ProductionTimeLine.ScaleTime;
    54             if (DataContext != null)
    69             if (DataContext != null)
    55             {
    70             {
    56                 if (((ProductionTimeLineVM)this.DataContext).SelectedChapter != -1)
    71                 if (((ProductionTimeLineVM)this.DataContext).SelectedChapter != -1)
    57                 {
    72                 {
    58                     if (!((ProductionTimeLineVM)DataContext).IsIndexing)
    73                     if (!((ProductionTimeLineVM)DataContext).IsIndexing)
   174            
   189            
   175         }
   190         }
   176         private void AddSequenceButton_Click(object sender, System.Windows.RoutedEventArgs e)
   191         private void AddSequenceButton_Click(object sender, System.Windows.RoutedEventArgs e)
   177         {
   192         {
   178             AddSequenceButton.Content = ((ProductionTimeLineVM)DataContext).TotalBookDuration;
   193             AddSequenceButton.Content = ((ProductionTimeLineVM)DataContext).TotalBookDuration;
       
   194            
       
   195            
   179         }
   196         }
   180 
   197 
   181         
   198         
   182 
   199 
   183         private void slider_ValueChanged(object sender, System.Windows.RoutedPropertyChangedEventArgs<double> e)
   200         private void slider_ValueChanged(object sender, System.Windows.RoutedPropertyChangedEventArgs<double> e)