Procházet zdrojové kódy

UI Teach Message 추가.

SK.Kang před 6 roky
rodič
revize
23843d78b5

+ 36 - 2
Dev/OHV/OHV.Common/Events/MessageEventArgs.cs

@@ -16,7 +16,6 @@ namespace OHV.Common.Events
         {
             RspIOObject,
             RspIOMapList,
-            RspJog,
         }
 
         public eGUIMessageKind Kind { get; set; }
@@ -42,7 +41,6 @@ namespace OHV.Common.Events
         {
             ReqIOObject,
             ReqIOMapList,
-            ReqJog,
         }
 
         public eVCSMessageKind Kind { get; set; }
@@ -52,6 +50,42 @@ namespace OHV.Common.Events
         public Dictionary<string, object> Args { get; set; }
     }
 
+    public class AxisControlEventArgs : EventArgs
+    {
+        public enum eEventDir
+        {
+            ToBack,
+            ToFront,
+        }
+
+        public enum eAxisControlKind
+        {
+            Stop,
+            EStop,
+            Move,
+            Jog,
+            CurrentPosition,
+            ServoOn,
+            ServoOff,
+            ReqCurrentPosition,
+            ReqStopCurrentPosition,
+        }
+
+        public enum eJogMoveDir
+        {
+            Positive = 0,
+            Negative,
+        }
+
+        public eEventDir Dir { get; set; }
+        public eAxisControlKind Kind { get; set; }
+        public eJogMoveDir JogDir { get; set; }
+        public string AxisName { get; set; }
+        public double CurrentPosition { get; set; }
+
+        public Dictionary<string, object> Args { get; set; }
+    }
+
     public class IOChangedMessageEventArgs: EventArgs
     {
         public object Args { get; set; }

+ 2 - 0
Dev/OHV/OHV.Common/Events/PubSubEvent.cs

@@ -15,4 +15,6 @@ namespace OHV.Common.Events
     public class IOChangedPubSubEvent : PubSubEvent<IOChangedMessageEventArgs> { }
 
     public class HostConnectedPubSubEvent : PubSubEvent<HostConnectedEventArgs> { }
+
+    public class AxisControlPubSubEvent : PubSubEvent<AxisControlEventArgs> { }
 }

+ 10 - 0
Dev/OHV/OHV.Module.Interactivity/OHV.Module.Interactivity.csproj

@@ -170,6 +170,16 @@
   <ItemGroup>
     <None Include="packages.config" />
   </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\..\..\GSG\GSG\GSG.NET.WPF\GSG.NET.WPF.csproj">
+      <Project>{6b91fca2-0a26-41d5-8959-a6f27645dacd}</Project>
+      <Name>GSG.NET.WPF</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\OHV.Common\OHV.Common.csproj">
+      <Project>{0d1f7fbc-bfb0-4ee4-852d-e2a8d62c5708}</Project>
+      <Name>OHV.Common</Name>
+    </ProjectReference>
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Import Project="..\packages\MaterialDesignThemes.3.0.1\build\MaterialDesignThemes.targets" Condition="Exists('..\packages\MaterialDesignThemes.3.0.1\build\MaterialDesignThemes.targets')" />
   <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">

+ 21 - 0
Dev/OHV/OHV.Module.Interactivity/PopUp/InOutView.xaml

@@ -4,11 +4,32 @@
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
              xmlns:local="clr-namespace:OHV.Module.Interactivity.PopUp"
+             xmlns:IOBtn="clr-namespace:GSG.NET.WPF.ControlResources;assembly=GSG.NET.WPF"
              mc:Ignorable="d" 
              xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
              xmlns:prism="http://prismlibrary.com/"
              prism:ViewModelLocator.AutoWireViewModel="True"
              Width="800" Height="600">
+
+    <prism:Dialog.WindowStyle>
+        <Style TargetType="Window">
+            <Setter Property="prism:Dialog.WindowStartupLocation" Value="CenterScreen" />
+            <Setter Property="Background" Value="Transparent"/>
+            <Setter Property="AllowsTransparency" Value="True"/>
+            <Setter Property="ResizeMode" Value="NoResize"/>
+            <Setter Property="WindowStyle" Value="None"/>
+            <Setter Property="BorderThickness" Value="1"/>
+            <Setter Property="BorderBrush" Value="{DynamicResource BorderSolidNormal}"/>
+            <Setter Property="Template" Value="{DynamicResource WindowTemplateKey}"/>
+
+            <!--<Style.Triggers>
+                <Trigger Property="ResizeMode" Value="CanResizeWithGrip">
+                    <Setter Property="Template" Value="{StaticResource WindowTemplateKey}"/>
+                </Trigger>
+            </Style.Triggers>-->
+        </Style>
+    </prism:Dialog.WindowStyle>
+
     <Grid>
         <DockPanel>
             <ContentControl Grid.Column="1" prism:RegionManager.RegionName="IOView"/>

+ 12 - 0
Dev/OHV/OHV.Module.Interactivity/PopUp/LockServoView.xaml

@@ -4,6 +4,7 @@
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
              xmlns:prism="http://prismlibrary.com/"
+             xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
              xmlns:local="clr-namespace:OHV.Module.Interactivity.PopUp"
              xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
              prism:ViewModelLocator.AutoWireViewModel="True"
@@ -257,6 +258,11 @@
                                 <materialDesign:PackIcon Kind="ArrowLeftBoldCircleOutline" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="30" Width="auto"/>
                                 <TextBlock><Run Text="Jog(-)"/></TextBlock>
                             </StackPanel>
+                            <i:Interaction.Triggers>
+                                <i:EventTrigger EventName="PreviewMouseDown">
+                                    <i:InvokeCommandAction Command="{Binding JogCommand}" CommandParameter="-"/>
+                                </i:EventTrigger>
+                            </i:Interaction.Triggers>
                         </Button>
 
                         <materialDesign:Badged
@@ -285,6 +291,12 @@
                                 <materialDesign:PackIcon Kind="ArrowRightBoldCircleOutline" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="30" Width="auto"/>
                                 <TextBlock><Run Text="Jog(+)"/></TextBlock>
                             </StackPanel>
+                            <i:Interaction.Triggers>
+                                <i:EventTrigger EventName="PreviewMouseDown">
+                                    <i:InvokeCommandAction Command="{Binding JogCommand}" CommandParameter="+"/>
+                                </i:EventTrigger>
+                            </i:Interaction.Triggers>
+
                         </Button>
                     </StackPanel>
                 </Grid>

+ 117 - 49
Dev/OHV/OHV.Module.Interactivity/PopUp/LockServoViewModel.cs

@@ -1,4 +1,7 @@
-using Prism.Commands;
+using OHV.Common.Events;
+using OHV.Common.Shareds;
+using Prism.Commands;
+using Prism.Events;
 using Prism.Mvvm;
 using Prism.Services.Dialogs;
 using System;
@@ -12,10 +15,10 @@ namespace OHV.Module.Interactivity.PopUp
 {
     public class LockServoViewModel : BindableBase, IDialogAware
     {
+
         private DelegateCommand<string> _closeDialogCommand;
         public DelegateCommand<string> CloseDialogCommand =>
-            _closeDialogCommand ?? ( _closeDialogCommand = new DelegateCommand<string>( CloseDialog ) );
-
+            _closeDialogCommand ?? (_closeDialogCommand = new DelegateCommand<string>(CloseDialog));
 
         private string _title = "LockServoView";
         public string Title
@@ -23,7 +26,7 @@ namespace OHV.Module.Interactivity.PopUp
             get { return this._title; }
             set
             {
-                this.SetProperty( ref this._title , value );
+                this.SetProperty(ref this._title, value);
             }
         }
 
@@ -31,7 +34,7 @@ namespace OHV.Module.Interactivity.PopUp
         public string SelectAxis
         {
             get => this._selectAxis;
-            set { this.SetProperty( ref this._selectAxis , value ); }
+            set { this.SetProperty(ref this._selectAxis, value); }
         }
 
         private string _selectedPosition = string.Empty;
@@ -40,7 +43,7 @@ namespace OHV.Module.Interactivity.PopUp
             get => this._selectedPosition;
             set
             {
-                this.SetProperty( ref this._selectedPosition , value );
+                this.SetProperty(ref this._selectedPosition, value);
             }
         }
 
@@ -49,21 +52,21 @@ namespace OHV.Module.Interactivity.PopUp
         public double TargetPosLockLeft
         {
             get { return this._targetPosLockLeft; }
-            set { this.SetProperty( ref this._targetPosLockLeft , value ); }
+            set { this.SetProperty(ref this._targetPosLockLeft, value); }
         }
 
         private double _currentLockLeft;
         public double CurrentLockLeft
         {
             get { return this._currentLockLeft; }
-            set { this.SetProperty( ref this._currentLockLeft , value ); }
+            set { this.SetProperty(ref this._currentLockLeft, value); }
         }
 
         private double _differenceLockLeft;
         public double DifferenceLockLeft
         {
             get { return this._differenceLockLeft; }
-            set { this.SetProperty( ref this._differenceLockLeft , value ); }
+            set { this.SetProperty(ref this._differenceLockLeft, value); }
         }
         #endregion
 
@@ -72,21 +75,21 @@ namespace OHV.Module.Interactivity.PopUp
         public double TargetPosLockRight
         {
             get { return this._targetPosLockRight; }
-            set { this.SetProperty( ref this._targetPosLockRight , value ); }
+            set { this.SetProperty(ref this._targetPosLockRight, value); }
         }
 
         private double _currentLockRight;
         public double CurrentLockRight
         {
             get { return this._currentLockRight; }
-            set { this.SetProperty( ref this._currentLockRight , value ); }
+            set { this.SetProperty(ref this._currentLockRight, value); }
         }
 
         private double _differenceLockRight;
         public double DifferenceLockRight
         {
             get { return this._differenceLockRight; }
-            set { this.SetProperty( ref this._differenceLockRight , value ); }
+            set { this.SetProperty(ref this._differenceLockRight, value); }
         }
         #endregion
 
@@ -100,74 +103,138 @@ namespace OHV.Module.Interactivity.PopUp
         public ICommand ServoOffCommand { get; set; }
         public ICommand FaultResetCommand { get; set; }
         public ICommand OriginCommand { get; set; }
+        public ICommand JogCommand { get; set; }
 
         public event Action<IDialogResult> RequestClose;
 
-        public LockServoViewModel( )
+        IEventAggregator eventAggregator;
+
+        public LockServoViewModel(IEventAggregator ea)
+        {
+            this.SelectAxisCommand = new DelegateCommand<object>(ExecuteSelectAxisCommand);
+            this.SelectPosCommand = new DelegateCommand<object>(ExecuteSelectPosCommand);
+            this.MoveToCommand = new DelegateCommand(ExecuteMoveToCommand);
+            this.CurrentToTargetCommand = new DelegateCommand(ExecuteCurrentToTargetCommand);
+            this.KeyInTargetPosCommand = new DelegateCommand<object>(ExecuteKeyInCommadn);
+
+            this.ServoOnCommand = new DelegateCommand(ExecuteServoOnCommand);
+            this.ServoOffCommand = new DelegateCommand(ExecuteServoOffCommand);
+            this.FaultResetCommand = new DelegateCommand(ExecuteFaultResetCommand);
+            this.OriginCommand = new DelegateCommand(ExecuteOriginCommand);
+
+            this.JogCommand = new DelegateCommand<object>(ExecuteJogCommand);
+
+            this.eventAggregator = ea;
+            this.eventAggregator.GetEvent<AxisControlPubSubEvent>().Unsubscribe(UICallbackCommunication);
+            this.eventAggregator.GetEvent<AxisControlPubSubEvent>().Subscribe(UICallbackCommunication, ThreadOption.UIThread);
+
+
+
+        }
+
+        private void ExecuteJogCommand(object obj)
+        {
+            var msg = new AxisControlEventArgs
+            {
+                Dir = AxisControlEventArgs.eEventDir.ToBack,
+                Kind = AxisControlEventArgs.eAxisControlKind.Jog,
+                AxisName = this.SelectAxis,
+            };
+
+            if (obj.ToString().Equals("+"))
+                msg.JogDir = AxisControlEventArgs.eJogMoveDir.Positive;
+            else
+                msg.JogDir = AxisControlEventArgs.eJogMoveDir.Negative;
+
+            PublishEvent(msg);
+        }
+
+        void PublishEvent(AxisControlEventArgs args)
         {
-            this.SelectAxisCommand = new DelegateCommand<object>( ExecuteSelectAxisCommand );
-            this.SelectPosCommand = new DelegateCommand<object>( ExecuteSelectPosCommand );
-            this.MoveToCommand = new DelegateCommand( ExecuteMoveToCommand );
-            this.CurrentToTargetCommand = new DelegateCommand( ExecuteCurrentToTargetCommand );
-            this.KeyInTargetPosCommand = new DelegateCommand<object>( ExecuteKeyInCommadn );
+            this.eventAggregator.GetEvent<AxisControlPubSubEvent>().Publish(args);
+        }
 
-            this.ServoOnCommand = new DelegateCommand( ExecuteServoOnCommand );
-            this.ServoOffCommand = new DelegateCommand( ExecuteServoOffCommand );
-            this.FaultResetCommand = new DelegateCommand( ExecuteFaultResetCommand );
-            this.OriginCommand = new DelegateCommand( ExecuteOriginCommand );
+        void UICallbackCommunication(AxisControlEventArgs args)
+        {
+            if (args.Dir == AxisControlEventArgs.eEventDir.ToFront)
+            {
+                switch (args.Kind)
+                {
+                    case AxisControlEventArgs.eAxisControlKind.Stop:
+                        break;
+                    case AxisControlEventArgs.eAxisControlKind.EStop:
+                        break;
+                    case AxisControlEventArgs.eAxisControlKind.Move:
+                        break;
+                    case AxisControlEventArgs.eAxisControlKind.Jog:
+                        break;
+                    case AxisControlEventArgs.eAxisControlKind.CurrentPosition:
+                        if (args.AxisName.Equals(ConstString.AXIS_CARRIER_LOCK_LEFT))
+                            this.CurrentLockLeft = args.CurrentPosition;
+                        else
+                            this.CurrentLockRight = args.CurrentPosition;
+                        break;
+                    case AxisControlEventArgs.eAxisControlKind.ServoOn:
+                        break;
+                    case AxisControlEventArgs.eAxisControlKind.ServoOff:
+                        break;
+                    default:
+                        break;
+                }
+            }
         }
 
-        private void ExecuteOriginCommand( )
+        private void ExecuteOriginCommand()
         {
         }
 
-        private void ExecuteFaultResetCommand( )
+        private void ExecuteFaultResetCommand()
         {
         }
 
-        private void ExecuteServoOffCommand( )
+        private void ExecuteServoOffCommand()
         {
         }
 
-        private void ExecuteServoOnCommand( )
+        private void ExecuteServoOnCommand()
         {
         }
 
-        private void ExecuteKeyInCommadn( object obj )
+        private void ExecuteKeyInCommadn(object obj)
         {
-            if ( obj.ToString().Equals( "Left" ) )
+            if (obj.ToString().Equals("Left"))
             {
                 var numPad = new CalcuratorView();
-                var result = numPad.ShowDialog( this.TargetPosLockLeft );
+                var result = numPad.ShowDialog(this.TargetPosLockLeft);
                 this.TargetPosLockLeft = result;
             }
             else
             {
                 var numPad = new CalcuratorView();
-                var result = numPad.ShowDialog( this.TargetPosLockRight );
+                var result = numPad.ShowDialog(this.TargetPosLockRight);
                 this.TargetPosLockRight = result;
             }
         }
 
-        private void ExecuteCurrentToTargetCommand( )
+        private void ExecuteCurrentToTargetCommand()
         {
             this.TargetPosLockLeft = this.CurrentLockLeft;
             this.TargetPosLockRight = this.CurrentLockRight;
         }
 
-        private async void ExecuteMoveToCommand( )
+        private async void ExecuteMoveToCommand()
         {
-            await Task.Run( ( ) =>
-            {
+            await Task.Run(() =>
+           {
                 //Axis.Move(this.SelectPosition);
-            } );
+            });
         }
 
-        private void ExecuteSelectPosCommand( object obj )
+        private void ExecuteSelectPosCommand(object obj)
         {
             this.SelectedPosition = obj.ToString();
 
-            switch ( this.SelectedPosition )
+            switch (this.SelectedPosition)
             {
                 case "Lock":
                     break;
@@ -178,43 +245,44 @@ namespace OHV.Module.Interactivity.PopUp
             }
         }
 
-        private void ExecuteSelectAxisCommand( object obj )
+        private void ExecuteSelectAxisCommand(object obj)
         {
             this.SelectAxis = obj.ToString();
         }
 
         #region Dialog 
-        public bool CanCloseDialog( )
+        public bool CanCloseDialog()
         {
             //throw new NotImplementedException();
             return true;
         }
 
-        public void OnDialogClosed( )
+        public void OnDialogClosed()
         {
-            //throw new NotImplementedException();
+            this.eventAggregator.GetEvent<AxisControlPubSubEvent>().Publish(new AxisControlEventArgs { Dir = AxisControlEventArgs.eEventDir.ToBack, Kind = AxisControlEventArgs.eAxisControlKind.ReqStopCurrentPosition});
+            this.eventAggregator.GetEvent<AxisControlPubSubEvent>().Unsubscribe(UICallbackCommunication);
         }
 
-        public void OnDialogOpened( IDialogParameters parameters )
+        public void OnDialogOpened(IDialogParameters parameters)
         {
-            //throw new NotImplementedException();
+            this.eventAggregator.GetEvent<AxisControlPubSubEvent>().Publish(new AxisControlEventArgs { Dir = AxisControlEventArgs.eEventDir.ToBack, Kind = AxisControlEventArgs.eAxisControlKind.ReqCurrentPosition });
         }
 
-        public virtual void RaiseRequestClose( IDialogResult dialogResult )
+        public virtual void RaiseRequestClose(IDialogResult dialogResult)
         {
-            RequestClose?.Invoke( dialogResult );
+            RequestClose?.Invoke(dialogResult);
         }
 
-        private void CloseDialog( string parameter )
+        private void CloseDialog(string parameter)
         {
             ButtonResult result = ButtonResult.None;
 
-            if ( parameter?.ToLower() == "true" )
+            if (parameter?.ToLower() == "true")
                 result = ButtonResult.OK;
-            else if ( parameter?.ToLower() == "false" )
+            else if (parameter?.ToLower() == "false")
                 result = ButtonResult.Cancel;
 
-            RaiseRequestClose( new DialogResult( result ) );
+            RaiseRequestClose(new DialogResult(result));
         }
         #endregion
     }

+ 95 - 5
Dev/OHV/VehicleControlSystem/ControlLayer/Clamp.cs

@@ -3,9 +3,14 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using GSG.NET.Concurrent;
 using GSG.NET.LINQ;
+using GSG.NET.Logging;
+using GSG.NET.Utils;
+using OHV.Common.Events;
 using OHV.Common.Shareds;
 using OHV.SqliteDAL;
+using Prism.Events;
 using VehicleControlSystem.ControlLayer.Axis;
 using VehicleControlSystem.ControlLayer.Lib.EziPlusE;
 
@@ -15,15 +20,97 @@ namespace VehicleControlSystem.ControlLayer
     {
         SqliteManager sql = null;
         List<EzAxis> axes = new List<EzAxis>();
+        static Logger logger = Logger.GetLogger();
 
-        public Clamp(SqliteManager sqliteManager)
+        IEventAggregator eventAggregator;
+        TaskCancel taskCancel = new TaskCancel();
+
+        public Clamp(SqliteManager sqliteManager, IEventAggregator ea)
         {
             this.sql = sqliteManager;
+            this.eventAggregator = ea;
         }
 
         public void Init()
         {
             this.CreateAxis();
+
+            this.eventAggregator.GetEvent<AxisControlPubSubEvent>().Unsubscribe(ReceivedMessageEvent);
+            this.eventAggregator.GetEvent<AxisControlPubSubEvent>().Subscribe(ReceivedMessageEvent);
+        }
+
+        void ReceivedMessageEvent(AxisControlEventArgs args)
+        {
+            if (args.Dir == AxisControlEventArgs.eEventDir.ToBack)
+            {
+                switch (args.Kind)
+                {
+                    case AxisControlEventArgs.eAxisControlKind.Stop:
+                        break;
+                    case AxisControlEventArgs.eAxisControlKind.EStop:
+                        break;
+                    case AxisControlEventArgs.eAxisControlKind.Move:
+                        break;
+                    case AxisControlEventArgs.eAxisControlKind.Jog:
+                        Task4.Go(() => this.ReqJog(args));
+                        break;
+                    case AxisControlEventArgs.eAxisControlKind.CurrentPosition:
+                        break;
+                    case AxisControlEventArgs.eAxisControlKind.ServoOn:
+                        break;
+                    case AxisControlEventArgs.eAxisControlKind.ServoOff:
+                        break;
+                    case AxisControlEventArgs.eAxisControlKind.ReqCurrentPosition:
+                        this.ReqStartCurrentPosition();
+                        break;
+                    case AxisControlEventArgs.eAxisControlKind.ReqStopCurrentPosition:
+                        this.taskCancel.Cancel();
+                        this.taskCancel.WaitAll();
+                        break;
+                    default:
+                        break;
+                }
+            }
+        }
+
+        void PublishEvent(AxisControlEventArgs args)
+        {
+            this.eventAggregator.GetEvent<AxisControlPubSubEvent>().Publish(args);
+        }
+
+        void ReqStartCurrentPosition()
+        {
+            var task = Task.Factory.StartNew(() =>
+            {
+                while (!this.taskCancel.Canceled)
+                {
+                    LockUtils.Wait(500);
+
+                    this.axes.ForEach(a =>
+                    {
+
+                        var msg = new AxisControlEventArgs
+                        {
+                            AxisName = a.Config.AxisName,
+                            Dir = AxisControlEventArgs.eEventDir.ToFront,
+                            Kind = AxisControlEventArgs.eAxisControlKind.CurrentPosition,
+                            CurrentPosition = NumUtils.Random(0, 300),
+                        };
+
+                        this.PublishEvent(msg);
+                    });
+                }
+            });
+
+            this.taskCancel.Add(task);
+        }
+
+        void ReqJog(AxisControlEventArgs arg)
+        {
+            if (arg.JogDir == AxisControlEventArgs.eJogMoveDir.Positive)
+                this.JogMove(arg.AxisName, E_JogMoveDir.Positive, 0);
+            else
+                this.JogMove(arg.AxisName, E_JogMoveDir.Negative, 0);
         }
 
         void CreateAxis()
@@ -95,7 +182,7 @@ namespace VehicleControlSystem.ControlLayer
                 {
                     if (x.Config.AxisName.Equals(ConstString.AXIS_CARRIER_LOCK_LEFT))
                         result = 5;
-                    else 
+                    else
                         result = 6;
                     return;
                 }
@@ -121,8 +208,11 @@ namespace VehicleControlSystem.ControlLayer
 
         public int JogMove(string axisName, E_JogMoveDir dir, int velocity)
         {
-            var axis = this.axes.Where(x => x.Config.AxisName.Equals(axisName)).Single();
-            return axis.JogMove(dir, velocity);
+            logger.D($"JogMove - Axis[{axisName} / Dir[{dir}] / vel[{velocity}]");
+
+            //var axis = this.axes.Where(x => x.Config.AxisName.Equals(axisName)).Single();
+            //return axis.JogMove(dir, velocity);
+            return 0;
         }
 
         public int MoveToLockPosition(string axisName)
@@ -170,7 +260,7 @@ namespace VehicleControlSystem.ControlLayer
             result = left.StartMove(leftData.Value, 0);
             if (result != EziMOTIONPlusELib.FMM_OK)
                 return result;
-            
+
             result = right.StartMove(rightData.Value, 0);
             if (result != EziMOTIONPlusELib.FMM_OK)
                 return result;

+ 6 - 3
Dev/OHV/VehicleControlSystem/ControlLayer/Vehicle.cs

@@ -10,6 +10,7 @@ using GSG.NET.Utils;
 using OHV.Common.Model;
 using OHV.Common.Shareds;
 using OHV.SqliteDAL;
+using Prism.Events;
 using VehicleControlSystem.ControlLayer.Actuator.Cylinder;
 using VehicleControlSystem.ControlLayer.Axis;
 using VehicleControlSystem.ControlLayer.IO;
@@ -74,8 +75,8 @@ namespace VehicleControlSystem.ControlLayer
             set { vehicleState = value; }
         }
 
-
-        public Vehicle(IIO io, SqliteManager sqliteManager)
+        IEventAggregator eventAggregator;
+        public Vehicle(IIO io, SqliteManager sqliteManager, IEventAggregator ea)
         {
             this.iO = io;
             this.motion = new GSIMotion();
@@ -89,6 +90,8 @@ namespace VehicleControlSystem.ControlLayer
                 "OUT_Obstruction_Bit_03",
                 "OUT_Obstruction_Bit_04",
             });
+
+            this.eventAggregator = ea;
         }
 
         public void Init()
@@ -363,7 +366,7 @@ namespace VehicleControlSystem.ControlLayer
 
         void CreateClamp()
         {
-            this.clamp = new Clamp(this.sql);
+            this.clamp = new Clamp(this.sql, this.eventAggregator);
             this.clamp.Init();
         }
 

+ 1 - 1
Dev/OHV/VehicleControlSystem/VCSystem.cs

@@ -64,7 +64,7 @@ namespace VehicleControlSystem
             this.scheduler = new Scheduler(eventAggregator, this.autoManager, this.sql);
             this.scheduler.Init();
 
-            this.vehicle = new Vehicle(this.IO, this.sql);
+            this.vehicle = new Vehicle(this.IO, this.sql, this.eventAggregator);
             this.vehicle.Init();
 
             this.hostManager = new HostManager(this.eventAggregator, this.vehicle, this.sql);