Update ProductionView
authorMatthieu Totet
Mon, 14 Dec 2009 09:56:55 +0100
changeset 21 253f142174ac
parent 20 c2dd8119a6c1
child 22 69a2910ec6f9
Update ProductionView
client/src/Iri.Modernisation.BaseMVVM/Commands/Commands.cs
client/src/Iri.Modernisation.Controls/Iri.Modernisation.Controls.csproj
client/src/Iri.Modernisation.Controls/View/ProductionEditor/ProductionEditor.xaml
client/src/Iri.Modernisation.Controls/View/ProductionTimeLine/ProductionTimeLine.xaml.cs
client/src/Iri.Modernisation.Controls/View/ProductionView/ProductionView.xaml
client/src/Iri.Modernisation.Controls/ViewModel/ProductionEditor/ProductionEditorVM.cs
client/src/Iri.Modernisation.Controls/ViewModel/ProductionView/ProductionViewVM.cs
--- a/client/src/Iri.Modernisation.BaseMVVM/Commands/Commands.cs	Fri Dec 11 10:48:58 2009 +0100
+++ b/client/src/Iri.Modernisation.BaseMVVM/Commands/Commands.cs	Mon Dec 14 09:56:55 2009 +0100
@@ -376,6 +376,12 @@
             {
                 EditorPartSelected = new Command("EditorPartSelected");
                 EditorPartFinished = new Command("EditorPartFinished");
+                IndexSelected = new Command("IndexSelected");
+            }
+            public static Command IndexSelected
+            {
+                get;
+                private set;
             }
             public static Command EditorPartSelected
             {
--- a/client/src/Iri.Modernisation.Controls/Iri.Modernisation.Controls.csproj	Fri Dec 11 10:48:58 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/Iri.Modernisation.Controls.csproj	Mon Dec 14 09:56:55 2009 +0100
@@ -85,6 +85,7 @@
     <Compile Include="ViewModel\NavigationBar\NavigationBarVM.cs" />
     <Compile Include="ViewModel\PolemicElementVM.cs" />
     <Compile Include="ViewModel\NavigationBar\ProductionMenuVM.cs" />
+    <Compile Include="ViewModel\ProductionEditor\ProductionEditorVM.cs" />
     <Compile Include="ViewModel\ProductionTimeLine\CustomableIndexElementVM.cs" />
     <Compile Include="ViewModel\ProductionTimeLine\CustomableVideoElementVM.cs" />
     <Compile Include="ViewModel\ProductionTimeLine\ProductionTimeLineVM.cs" />
--- a/client/src/Iri.Modernisation.Controls/View/ProductionEditor/ProductionEditor.xaml	Fri Dec 11 10:48:58 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/View/ProductionEditor/ProductionEditor.xaml	Mon Dec 14 09:56:55 2009 +0100
@@ -9,9 +9,9 @@
         </StackPanel>
         <View:VideoViewer Margin="0,0,24,0"  Height="227"/> 
         <StackPanel x:Name="DescriptionSegmentPanel" Height="128">
-            <TextBox x:Name="TitleSegmentLabel" Text="Title Segment" TextWrapping="Wrap" Height="24" Margin="0,0,8,0"/>
-            <TextBox  x:Name="DescriptionSegmentLabel"  Text="Desc Segment" TextWrapping="Wrap" Height="64" AcceptsReturn="True" VerticalScrollBarVisibility="Visible"/>
-            <TextBox  x:Name="KeyWordLabel" Text="KeyWord Segment" TextWrapping="Wrap" Height="24" Margin="0,0,8,0"/>
+            <TextBox IsEnabled="{Binding  IsEditableIndex}" x:Name="TitleSegmentLabel" Text="{Binding  SelectedIndexTitle,Mode=TwoWay}" TextWrapping="Wrap" Height="24" Margin="0,0,8,0"/>
+            <TextBox  IsEnabled="{Binding  IsEditableIndex}" x:Name="DescriptionSegmentLabel"  Text="{Binding  SelectedIndexDescription,Mode=TwoWay}" TextWrapping="Wrap" Height="64" AcceptsReturn="True" VerticalScrollBarVisibility="Visible"/>
+            <TextBox  IsEnabled="{Binding  IsEditableIndex}" x:Name="KeyWordLabel" Text="{Binding  SelectedIndexTags,Mode=TwoWay}" TextWrapping="Wrap" Height="24" Margin="0,0,8,0"/>
         </StackPanel>
     </StackPanel>
 </UserControl>
--- a/client/src/Iri.Modernisation.Controls/View/ProductionTimeLine/ProductionTimeLine.xaml.cs	Fri Dec 11 10:48:58 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/View/ProductionTimeLine/ProductionTimeLine.xaml.cs	Mon Dec 14 09:56:55 2009 +0100
@@ -107,6 +107,7 @@
                                     an.MouseLeftButtonUp += new MouseButtonEventHandler(an_MouseLeftButtonUp);
                                     //((ProductionTimeLineVM)DataContext).SelectedBookChapter);
                                     AnnotationTimeStrip.Children.Add(an);
+                                
                                
                             }
                             
@@ -148,6 +149,28 @@
                 _comePoint = e.GetPosition(((CustomableIndexElement)sender));
                 _isTrimRightCapturated = true;
             }
+            foreach(ObservableCollection<SegmentIndex> Ocsi in ((ProductionTimeLineVM)DataContext).ListIndex)
+            {
+                foreach (SegmentIndex Si in Ocsi )
+                {
+                   
+                    if (((CustomableIndexElementVM)_selectedIndex.DataContext).SegmentIndex == Si)
+                    {
+                        if (Ocsi == ((ProductionTimeLineVM)DataContext).SelectedIndex)
+                        {
+                            Commands.ProductionTimeLine.IndexSelected.Execute(true,Si);
+                        }
+                        else
+                        {
+
+                            Commands.ProductionTimeLine.IndexSelected.Execute(false, Si); 
+                        }
+                        
+                    }
+                }
+            }
+
+        
            
         }
         private void AddSequenceButton_Click(object sender, System.Windows.RoutedEventArgs e)
--- a/client/src/Iri.Modernisation.Controls/View/ProductionView/ProductionView.xaml	Fri Dec 11 10:48:58 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/View/ProductionView/ProductionView.xaml	Mon Dec 14 09:56:55 2009 +0100
@@ -14,7 +14,7 @@
 
     	<View:HeaderProduction DataContext="{Binding ViewModelHeaderProduction}" x:Name="HeaderProductionElement" HorizontalAlignment="Left" VerticalAlignment="Top" d:LayoutOverrides="VerticalAlignment"/>
     	<View:ProductionTimeLine x:Name="ProductionTimeLineElement" Height="176" VerticalAlignment="Bottom" DataContext="{Binding ViewModelProductionTimeLine}"/>
-    	<View:ProductionEditor Margin="272,115,0,0" HorizontalAlignment="Left" Height="381" VerticalAlignment="Top"/>
+    	<View:ProductionEditor DataContext="{Binding ViewModelProductionEditor}" Margin="272,115,0,0" HorizontalAlignment="Left" Height="381" VerticalAlignment="Top"/>
     	<View:VideoViewer HorizontalAlignment="Right" Margin="0,115,8,204" Width="404"/>
     	<StackPanel x:Name="RecordsPanel" HorizontalAlignment="Left" Margin="8,240,0,216" Width="248">
     		<TextBlock Style="{StaticResource CommonTextBlock}" Text="{Binding RecordsLabel, Source={StaticResource LangLabels}}" x:Name="RecordLabel" TextWrapping="Wrap"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/src/Iri.Modernisation.Controls/ViewModel/ProductionEditor/ProductionEditorVM.cs	Mon Dec 14 09:56:55 2009 +0100
@@ -0,0 +1,135 @@
+using System;
+using System.Net;
+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.BaseMVVM;
+using Iri.Modernisation.Data.Models;
+using System.Collections.Generic;
+using System.Linq;
+using Iri.Modernisation.BaseMVVM.Commands;
+namespace Iri.Modernisation.Controls.ViewModel
+{
+    public class ProductionEditorVM: BaseMVVM.ViewModel.ViewModel
+    {
+        private VideoViewerVM _videoViewerVM;
+        public VideoViewerVM ViewModelVideoViewer
+        {
+            get
+            {
+                return _videoViewerVM;
+            }
+            set
+            {
+                _videoViewerVM = value;
+                OnPropertyChanged("ViewModelVideoViewer");
+            }
+        }
+
+        private PolemicElement _selectedSegmentIndex;
+
+        private String _selectedIndexTitle;
+        public String SelectedIndexTitle
+        {
+            get
+            {
+                return _selectedIndexTitle;
+            }
+            set
+            {
+                _selectedIndexTitle = value;
+                _selectedSegmentIndex.Title = value;
+                OnPropertyChanged("SelectedIndexTitle");
+            }
+        }
+
+        private String _selectedIndexDescription;
+        public String SelectedIndexDescription
+        {
+            get
+            {
+                return _selectedIndexDescription;
+            }
+            set
+            {
+                _selectedIndexDescription = value;
+                _selectedSegmentIndex.Description = value;
+                OnPropertyChanged("SelectedIndexDescription");
+            }
+        }
+
+        private List<String> _selectedIndexTags = new List<String>();
+        public String SelectedIndexTags
+        {
+            get
+            {
+                try
+                {
+                    return String.Join(",", _selectedIndexTags.ToArray());
+                }
+                catch
+                {
+                    return String.Empty;
+                }
+            }
+            set
+            {
+                String val = (String)value;
+                _selectedIndexTags = val.Split(',').ToList();
+                _selectedSegmentIndex.Tags = val.Split(',').ToList();
+                OnPropertyChanged("Tags");
+
+
+            }
+        }
+
+        private bool _isRecordMode;
+        public bool IsRecordMode
+        {
+            get
+            {
+                return _isRecordMode;
+            }
+            set
+            {
+                _isRecordMode = value;
+                OnPropertyChanged("IsRecordMode");
+            }
+        }
+
+        private bool _isEditableIndex;
+        public bool IsEditableIndex
+        {
+            get
+            {
+                return _isEditableIndex;
+            }
+            set
+            {
+                _isEditableIndex = value;
+                OnPropertyChanged("IsEditableIndex");
+            }
+        }
+
+        public ProductionEditorVM()
+        {
+            Commands.ProductionTimeLine.IndexSelected.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(IndexSelected_Executed);
+
+        }
+
+        void IndexSelected_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
+        {
+            IsEditableIndex = (bool)e.Parameter;
+            _selectedSegmentIndex = (SegmentIndex)e.Source;
+            _selectedIndexTitle = _selectedSegmentIndex.Title;
+            _selectedIndexTags = _selectedSegmentIndex.Tags;
+            _selectedIndexDescription = _selectedSegmentIndex.Description;
+            OnPropertyChanged(String.Empty);
+        }
+    }
+}
--- a/client/src/Iri.Modernisation.Controls/ViewModel/ProductionView/ProductionViewVM.cs	Fri Dec 11 10:48:58 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/ViewModel/ProductionView/ProductionViewVM.cs	Mon Dec 14 09:56:55 2009 +0100
@@ -75,12 +75,27 @@
                 OnPropertyChanged("ViewModelProductionTimeLine");
             }
         }
+
+        private ProductionEditorVM _productionEditorVM;
+        public ProductionEditorVM ViewModelProductionEditor
+        {
+            get
+            {
+                return _productionEditorVM;
+            }
+            set
+            {
+                _productionEditorVM = value;
+                OnPropertyChanged("ViewModelProductionEditor");
+            }
+        }
         //SelectedChapter
         public ProductionViewVM()
         {
             RecordedVideoSequences = new ObservableCollection<VideoSequence>();
             ViewModelHeaderProduction = new HeaderProductionVM();
             ViewModelProductionTimeLine = new ProductionTimeLineVM();
+            ViewModelProductionEditor = new ProductionEditorVM();
             Commands.ProductionView.ClickAddSelectedRecord.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(ClickAddSelectedRecord_Executed);
             Random rndNumbers = new Random();
             for (int i = 0; i < 10; i++)