Update ProductionView and Components
authorMatthieu Totet
Thu, 03 Dec 2009 16:05:43 +0100
changeset 16 dde0338cb539
parent 15 3f70aee2432f
child 17 0e4e63f6f567
Update ProductionView and Components
client/src/Iri.Modernisation.Controls/View/HeaderProduction/HeaderProductionPartControler.xaml
client/src/Iri.Modernisation.Controls/View/HeaderProduction/HeaderProductionPartControler.xaml.cs
client/src/Iri.Modernisation.Controls/ViewModel/ProductionView/ProductionViewVM.cs
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/src/Iri.Modernisation.Controls/View/HeaderProduction/HeaderProductionPartControler.xaml	Thu Dec 03 16:05:43 2009 +0100
@@ -0,0 +1,70 @@
+<UserControl
+	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" x:Name="userControl"
+	mc:Ignorable="d"
+	xmlns:System="clr-namespace:System;assembly=mscorlib"
+	
+	x:Class="Iri.Modernisation.Controls.View.HeaderProductionPartControler" Width="128">
+
+	<Grid x:Name="LayoutRoot">
+		<VisualStateManager.VisualStateGroups>
+			<VisualStateGroup x:Name="Displays">
+				<VisualState x:Name="Finished">
+					<Storyboard>
+						<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="textBlock" Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)">
+							<EasingColorKeyFrame KeyTime="00:00:00" Value="#FF65FF00"/>
+						</ColorAnimationUsingKeyFrames>
+						<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="but" Storyboard.TargetProperty="(UIElement.Visibility)">
+							<DiscreteObjectKeyFrame KeyTime="00:00:00">
+								<DiscreteObjectKeyFrame.Value>
+									<Visibility>Collapsed</Visibility>
+								</DiscreteObjectKeyFrame.Value>
+							</DiscreteObjectKeyFrame>
+						</ObjectAnimationUsingKeyFrames>
+					</Storyboard>
+				</VisualState>
+				<VisualState x:Name="Available">
+					<Storyboard>
+						<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="textBlock" Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)">
+							<EasingColorKeyFrame KeyTime="00:00:00" Value="#FFFF7E00"/>
+						</ColorAnimationUsingKeyFrames>
+						<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="but" Storyboard.TargetProperty="(Control.IsEnabled)">
+							<DiscreteObjectKeyFrame KeyTime="00:00:00">
+								<DiscreteObjectKeyFrame.Value>
+									<System:Boolean>False</System:Boolean>
+								</DiscreteObjectKeyFrame.Value>
+							</DiscreteObjectKeyFrame>
+						</ObjectAnimationUsingKeyFrames>
+						<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="but" Storyboard.TargetProperty="(UIElement.Visibility)">
+							<DiscreteObjectKeyFrame KeyTime="00:00:00">
+								<DiscreteObjectKeyFrame.Value>
+									<Visibility>Visible</Visibility>
+								</DiscreteObjectKeyFrame.Value>
+							</DiscreteObjectKeyFrame>
+						</ObjectAnimationUsingKeyFrames>
+					</Storyboard>
+				</VisualState>
+				<VisualState x:Name="Selected">
+					<Storyboard>
+						<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="textBlock" Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)">
+							<EasingColorKeyFrame KeyTime="00:00:00" Value="#FFFFF700"/>
+						</ColorAnimationUsingKeyFrames>
+						<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="but" Storyboard.TargetProperty="(UIElement.Visibility)">
+							<DiscreteObjectKeyFrame KeyTime="00:00:00">
+								<DiscreteObjectKeyFrame.Value>
+									<Visibility>Visible</Visibility>
+								</DiscreteObjectKeyFrame.Value>
+							</DiscreteObjectKeyFrame>
+						</ObjectAnimationUsingKeyFrames>
+					</Storyboard>
+				</VisualState>
+			</VisualStateGroup>
+		</VisualStateManager.VisualStateGroups>
+		
+		
+		<TextBlock x:Name="textBlock" HorizontalAlignment="Left" Foreground="Red" Text="{Binding Path=Text, ElementName=userControl, Mode=OneWay}" TextWrapping="Wrap" MouseLeftButtonDown="textBlock_MouseLeftButtonDown" d:LayoutOverrides="VerticalMargin"/>
+		<Button Width="32"  x:Name="but" Content="Ok" Click="but_Click" Visibility="Collapsed" HorizontalAlignment="Right"/>
+	</Grid>
+</UserControl>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/src/Iri.Modernisation.Controls/View/HeaderProduction/HeaderProductionPartControler.xaml.cs	Thu Dec 03 16:05:43 2009 +0100
@@ -0,0 +1,136 @@
+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 System.Windows.Data;
+namespace Iri.Modernisation.Controls.View
+{
+	public partial class HeaderProductionPartControler : UserControl
+	{
+
+
+
+        public bool IsActive
+        {
+            get { return (bool)GetValue(IsActiveProperty); }
+            set 
+            { 
+                
+                if (value)
+                {
+                    Active();
+                }
+                else
+                {
+                }
+                SetValue(IsActiveProperty, value);
+            }
+        }
+
+        // Using a DependencyProperty as the backing store for IsActive.  This enables animation, styling, binding, etc...
+        public static readonly DependencyProperty IsActiveProperty =
+            DependencyProperty.Register("IsActive", typeof(bool), typeof(HeaderProductionPartControler), new PropertyMetadata(false));
+
+
+
+        public String Text
+        {
+            get { return (String)GetValue(TextProperty); }
+            set 
+            { SetValue(TextProperty, value); 
+                textBlock.Text = value; 
+            }
+        }
+            
+        // Using a DependencyProperty as the backing store for Text.  This enables animation, styling, binding, etc...
+        public static readonly DependencyProperty TextProperty =
+            DependencyProperty.Register("Text", typeof(String), typeof(HeaderProductionPartControler), new PropertyMetadata(""));
+
+
+		
+		public HeaderProductionPartControler()
+		{
+			// Required to initialize variables
+			InitializeComponent();
+            IsActive = false;
+			_activated = false;
+			_finished= false;
+          
+            
+           
+
+		}
+		
+        private bool _activated;
+		private bool _finished;
+		
+		public void Active()
+		{
+			if(!_activated && !_finished)
+			{
+				VisualStateManager.GoToState(this,"Available",true);
+				_activated=true;
+			}
+            
+		}
+		
+		public void UnSelect()
+		{
+			if(_activated && !_finished)
+			VisualStateManager.GoToState(this,"Available",true);
+		}
+		private void Button_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
+		{
+           
+		
+		}
+
+		private void but_Click(object sender, System.Windows.RoutedEventArgs e)
+		{
+		     	
+				if(_activated)
+				{
+					VisualStateManager.GoToState(this,"Finished",true);
+                    if (HeaderProductionPartFinished!=null)
+                    {
+                      HeaderProductionPartFinished(this, new HeaderProductionPartControlerEventArgs(sender));
+                    }
+					_finished=true;
+                    
+				}
+		}
+        public void Select()
+        {
+            if (_activated && !_finished)
+            {
+                VisualStateManager.GoToState(this, "Selected", true);
+            }
+        }
+		private void textBlock_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
+		{
+            if (_activated && !_finished)
+            {
+                if (HeaderProductionPartSelected != null)
+                    HeaderProductionPartSelected(this, new HeaderProductionPartControlerEventArgs(this));
+            }
+        }
+        public event EventHandler<HeaderProductionPartControlerEventArgs> HeaderProductionPartUnSelected;
+        public event EventHandler<HeaderProductionPartControlerEventArgs> HeaderProductionPartFinished;
+        public event EventHandler<HeaderProductionPartControlerEventArgs> HeaderProductionPartSelected;
+	}
+
+    public class HeaderProductionPartControlerEventArgs : EventArgs
+    {
+        public object sender { get; set; }
+        public HeaderProductionPartControlerEventArgs(object psender)
+        {
+            sender = psender;
+        }
+
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/src/Iri.Modernisation.Controls/ViewModel/ProductionView/ProductionViewVM.cs	Thu Dec 03 16:05:43 2009 +0100
@@ -0,0 +1,50 @@
+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.Commands;
+using Iri.Modernisation.BaseMVVM.ViewModel;
+namespace Iri.Modernisation.Controls.ViewModel
+{
+    public class ProductionViewVM : BaseMVVM.ViewModel.ViewModel
+    {
+        private HeaderProductionVM _headerProductionVM;
+        public HeaderProductionVM ViewModelHeaderProduction
+        {
+            get
+            {
+                return _headerProductionVM;
+            }
+            set
+            {
+                _headerProductionVM = value;
+                OnPropertyChanged("ViewModelHeaderProduction");
+            }
+        }
+        private ProductionTimeLineVM _productionTimeLineVM;
+        public ProductionTimeLineVM ViewModelProductionTimeLine
+        {
+            get
+            {
+                return _productionTimeLineVM;
+            }
+            set
+            {
+                _productionTimeLineVM = value;
+                OnPropertyChanged("ViewModelProductionTimeLine");
+            }
+        }
+
+        public ProductionViewVM()
+        {
+            ViewModelHeaderProduction = new HeaderProductionVM();
+            ViewModelProductionTimeLine = new ProductionTimeLineVM();
+        }
+    }
+}