client/src/Iri.Modernisation.Controls/View/ProductionTimeLine/ProductionTimeLine.xaml.cs
changeset 17 0e4e63f6f567
parent 0 249d70e7b32d
child 18 66911d0f0eb6
equal deleted inserted replaced
16:dde0338cb539 17:0e4e63f6f567
    24         }
    24         }
    25 		public ProductionTimeLine()
    25 		public ProductionTimeLine()
    26 		{
    26 		{
    27 			// Required to initialize variables
    27 			// Required to initialize variables
    28 			InitializeComponent();
    28 			InitializeComponent();
       
    29           
    29             Commands.Action.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(Action_Executed);
    30             Commands.Action.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(Action_Executed);
    30           
    31           
    31 		}
    32 		}
    32 
    33 
    33         void Action_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
    34         void Action_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
    36         }
    37         }
    37 
    38 
    38         private void AddSequenceButton_Click(object sender, System.Windows.RoutedEventArgs e)
    39         private void AddSequenceButton_Click(object sender, System.Windows.RoutedEventArgs e)
    39         {
    40         {
    40             Random rndNumbers = new Random();
    41             Random rndNumbers = new Random();
    41        
    42             if(!((ProductionTimeLineVM)DataContext).IsIndexing)
       
    43             {
    42 
    44 
    43             CustomableVideoElement _temp = new CustomableVideoElement()
    45             CustomableVideoElement _temp = new CustomableVideoElement()
    44                                      {
    46                                      {
    45                                          DataContext = new CustomableVideoElementVM(new VideoSequence()
    47                                          DataContext = new CustomableVideoElementVM(new VideoSequence()
    46                                          {
    48                                          {
    47 
    49 
    48                                              RunTime = new TimeSpan(0, rndNumbers.Next(10,60), 0),
    50                                              RunTime = new TimeSpan(0, rndNumbers.Next(10, 60), 0),
    49                                              BeginTrim = new TimeSpan(0, 0, 0),
    51                                              BeginTrim = new TimeSpan(0, 0, 0),
    50                                              EndTrim = new TimeSpan(0, 0, 0)
    52                                              EndTrim = new TimeSpan(0, 0, 0),
    51                                          }),
    53 
    52                                        // Width = 200
    54                                          }) { Chapter = ((ProductionTimeLineVM)this.DataContext).SelectedChapterType},
       
    55                                          // Width = 200
    53                                      };
    56                                      };
       
    57             
    54             _temp.MouseMove += new MouseEventHandler(CustomableVideoElement_MouseMove);
    58             _temp.MouseMove += new MouseEventHandler(CustomableVideoElement_MouseMove);
    55             _temp.MouseLeftButtonDown += new MouseButtonEventHandler(CustomableVideoElement_MouseLeftButtonDown);
    59             _temp.MouseLeftButtonDown += new MouseButtonEventHandler(CustomableVideoElement_MouseLeftButtonDown);
    56             _temp.MouseLeftButtonUp += new MouseButtonEventHandler(CustomableVideoElement_MouseLeftButtonUp);
    60             _temp.MouseLeftButtonUp += new MouseButtonEventHandler(CustomableVideoElement_MouseLeftButtonUp);
    57             TimeStrip.Children.Add(_temp  );// TODO: Add event handler implementation here.
    61             
       
    62                VideoTimeStrip.Children.Add(_temp  );// TODO: Add event handler implementation here.
       
    63             }
       
    64             else
       
    65             {
       
    66                 VideoChapter vc = ((ProductionTimeLineVM)DataContext).SelectedBookChapter;
       
    67                 PolemicElementControl an = new PolemicElementControl()
       
    68                 {
       
    69                     DataContext = new PolemicElementVM(new SegmentIndex(vc))
       
    70                     {
       
    71                         TimerIn = TimeSpan.Zero,
       
    72                         Duration = new TimeSpan(0, rndNumbers.Next(10, 60), 0)
       
    73                     },
       
    74                 };
       
    75                     //((ProductionTimeLineVM)DataContext).SelectedBookChapter);
       
    76                 AnnotationTimeStrip.Children.Add(an);
       
    77             }
    58         }
    78         }
    59 
    79 
    60         
    80         
    61 
    81 
    62         private void slider_ValueChanged(object sender, System.Windows.RoutedPropertyChangedEventArgs<double> e)
    82         private void slider_ValueChanged(object sender, System.Windows.RoutedPropertyChangedEventArgs<double> e)
    73 
    93 
    74         private CustomableVideoElement _selected;
    94         private CustomableVideoElement _selected;
    75         void CustomableVideoElement_MouseMove(object sender, MouseEventArgs e)
    95         void CustomableVideoElement_MouseMove(object sender, MouseEventArgs e)
    76         {
    96         {
    77 
    97 
    78             _selected = ((CustomableVideoElement)sender);
    98             
    79             if (_isTrimRightCapturated && ((CustomableVideoElement)sender).CaptureMouse())
    99             if (_isTrimRightCapturated && ((CustomableVideoElement)sender).CaptureMouse())
    80             {
   100             {
    81                 ((CustomableVideoElement)sender).TrimRight = _comePoint.X  - e.GetPosition(((CustomableVideoElement)sender)).X;
   101                 ((CustomableVideoElement)sender).TrimRight = _comePoint.X  - e.GetPosition(((CustomableVideoElement)sender)).X;
    82                 _comePoint = e.GetPosition(((CustomableVideoElement)sender));
   102                 _comePoint = e.GetPosition(((CustomableVideoElement)sender));
    83             }
   103             }
    94             _isTrimLeftCapturated = false;
   114             _isTrimLeftCapturated = false;
    95         }
   115         }
    96 
   116 
    97         void CustomableVideoElement_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
   117         void CustomableVideoElement_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
    98         {
   118         {
       
   119             _selected = ((CustomableVideoElement)sender);
    99             if (e.GetPosition(((CustomableVideoElement)sender)).X >= ((CustomableVideoElement)sender).Width - 5)
   120             if (e.GetPosition(((CustomableVideoElement)sender)).X >= ((CustomableVideoElement)sender).Width - 5)
   100             {
   121             {
   101                 _comePoint = e.GetPosition(((CustomableVideoElement)sender));
   122                 _comePoint = e.GetPosition(((CustomableVideoElement)sender));
   102                 _isTrimRightCapturated = true;
   123                 _isTrimRightCapturated = true;
   103             }
   124             }
   108             }
   129             }
   109         }
   130         }
   110 
   131 
   111         private void DeleteSequenceButton_Click(object sender, System.Windows.RoutedEventArgs e)
   132         private void DeleteSequenceButton_Click(object sender, System.Windows.RoutedEventArgs e)
   112         {
   133         {
   113             TimeStrip.Children.Remove(_selected);
   134             VideoTimeStrip.Children.Remove(_selected);
   114         }
   135         }
   115 	}
   136 	}
   116 }
   137 }