Quellcode durchsuchen

Merge branch 'master' of http://unque781.synology.me:3000/GSI/OHV

DESKTOP-Kang vor 6 Jahren
Ursprung
Commit
83df142554

+ 17 - 0
Dev/OHV/OHV.Common/Events/MessageEventArgs.cs

@@ -169,6 +169,19 @@ namespace OHV.Common.Events
             STOP,
             Steering,
             SteeringState,
+            ReqCurrentPos,
+            ReqStopCurrentPos,
+            FaultReset,
+            DriveON,
+            DriveOFF,
+            JOG,
+
+        }
+
+        public enum eJogMoveDir
+        {
+            Positive = 0,
+            Negative,
         }
 
         public enum eMoveDir
@@ -177,6 +190,10 @@ namespace OHV.Common.Events
             RIGHT,
         }
 
+        
+        public double CurrentPosition { get; set; }
+
+        public eJogMoveDir JogDir { get; set; }
         public eEventDir EventDir { get; set; }
         public eControlKind ControlKind { get; set; }
         public eMoveDir MoveDir { get; set; }

+ 1 - 1
Dev/OHV/OHV.Common/Events/PubSubEvent.cs

@@ -18,7 +18,7 @@ namespace OHV.Common.Events
 
     public class AxisControlPubSubEvent : PubSubEvent<AxisControlEventArgs> { }
 
-    public class DirveControlPubSubEvent : PubSubEvent<DriveControlEventArgs> { }
+    public class DriveControlPubSubEvent : PubSubEvent<DriveControlEventArgs> { }
 
     public class IOControlPubSubEvent : PubSubEvent<IOControlEventArgs> { }
     public class VehicleCommandListChanged : PubSubEvent<string> { }

+ 109 - 27
Dev/OHV/OHV.Module.Interactivity/PopUp/ConveyorControlView.xaml

@@ -43,21 +43,86 @@
                     <RowDefinition Height="*"/>
                     <RowDefinition Height="*"/>
                 </Grid.RowDefinitions>
-
+                
+                <Border BorderBrush="Gray" BorderThickness="1" Grid.Row="0"/>
+                <Border BorderBrush="Gray" BorderThickness="1" Grid.Row="1"/>
+                
                 <Grid Grid.Row="0">
-                    <Button Content="Conveyor Control" Foreground="Orange" Background="{x:Null}" FontSize="20"
+                    <Grid.ColumnDefinitions>
+                        <ColumnDefinition Width="*"/>
+                        <ColumnDefinition Width="*"/>
+                    </Grid.ColumnDefinitions>
+                    
+                    
+                    <StackPanel Grid.Column="0"
+                                Orientation="Vertical"
+                                HorizontalAlignment="Center"
+                                VerticalAlignment="Center">
+                        
+                        <Button Background="{x:Null}">
+                            <StackPanel Orientation="Horizontal">
+                                <Ellipse Margin="0,0,16,0" Width="20" Height="20" Fill="{Binding CvRun, FallbackValue=Red}"/>
+                                <TextBlock Text="CV RUN"/>
+                            </StackPanel>
+                        </Button>
+
+                        <Button Background="{x:Null}">
+                            <StackPanel Orientation="Horizontal">
+                                <Ellipse Margin="0,0,16,0" Width="20" Height="20" Fill="{Binding CvCWCCW, FallbackValue=Red}"/>
+                                <TextBlock Text="CV CW"/>
+                            </StackPanel>
+                        </Button>
+
+                        <Button Background="{x:Null}">
+                            <StackPanel Orientation="Horizontal">
+                                <Ellipse Margin="0,0,16,0" Width="20" Height="20" Fill="{Binding CvCWCCW, FallbackValue=Red}"/>
+                                <TextBlock Text="CV CCW"/>
+                            </StackPanel>
+                        </Button>
+
+                        <Button Background="{x:Null}">
+                            <StackPanel Orientation="Horizontal">
+                                <Ellipse Margin="0,0,16,0" Width="20" Height="20" Fill="{Binding CvEntryIn, FallbackValue=Red}"/>
+                                <TextBlock Text="CV EntryIn"/>
+                            </StackPanel>
+                        </Button>
+
+                        <Button Background="{x:Null}">
+                            <StackPanel Orientation="Horizontal">
+                                <Ellipse Margin="0,0,16,0" Width="20" Height="20" Fill="{Binding CvSlowStop, FallbackValue=Red}"/>
+                                <TextBlock Text="CV Slow-S"/>
+                            </StackPanel>
+                        </Button>
+
+                        <Button Background="{x:Null}">
+                            <StackPanel Orientation="Horizontal">
+                                <Ellipse Margin="0,0,16,0" Width="20" Height="20" Fill="{Binding CvStop, FallbackValue=Red}"/>
+                                <TextBlock Text="CV Stop-S"/>
+                            </StackPanel>
+                        </Button>
+
+                    </StackPanel>
+                    
+                    <StackPanel Orientation="Horizontal"
+                                HorizontalAlignment="Center"
+                                VerticalAlignment="Top"
+                                Grid.Column="1" Margin="20">
+                        <Button Content="Conveyor Control" Foreground="Orange" Background="{x:Null}" FontSize="20"
                             VerticalAlignment="Top" HorizontalAlignment="Left"
                             Width="Auto" Height="50"/>
+                    </StackPanel>
+                    
                     <StackPanel Orientation="Horizontal"
-                                HorizontalAlignment="Center">
+                                HorizontalAlignment="Center"
+                                Grid.Column="1">
 
                         <Button HorizontalAlignment="Stretch"
                             Style="{StaticResource MaterialDesignRaisedButton}"
                             materialDesign:ButtonAssist.CornerRadius="10"
                             Command="{Binding ConveyorRunCommand}"
                             CommandParameter="CW"
-                            Height="100" Width="100"
-                            Margin="15">
+                            Height="80" Width="80"
+                            Margin="10">
                             <StackPanel>
                                 <materialDesign:PackIcon Kind="TransferUp" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="42" Width="auto"/>
                                 <TextBlock Text="CW" VerticalAlignment="Stretch" HorizontalAlignment="Center" />
@@ -67,8 +132,8 @@
                         <Button 
                             Style="{StaticResource MaterialDesignRaisedButton}"
                             materialDesign:ButtonAssist.CornerRadius="10"
-                            Height="100" Width="100"
-                            Margin="15"
+                            Height="80" Width="80"
+                            Margin="10"
                             Command="{Binding ConveyorRunCommand}"
                             CommandParameter="CCW">
                             <StackPanel>
@@ -82,8 +147,8 @@
                             materialDesign:ButtonAssist.CornerRadius="10"
                             Command="{Binding ConveyorRunCommand}"
                             CommandParameter="STOP"
-                            Height="100" Width="100"
-                            Margin="15">
+                            Height="80" Width="80"
+                            Margin="10">
                             <StackPanel>
                                 <materialDesign:PackIcon Kind="StopCircleOutline" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="42" Width="auto"/>
                                 <TextBlock Text="Stop" VerticalAlignment="Stretch" HorizontalAlignment="Center" />
@@ -93,46 +158,63 @@
                 </Grid>
 
                 <Grid Grid.Row="1">
-                    <Button Content="Carrier Control" Foreground="Orange" Background="{x:Null}" FontSize="20"
+                    <Grid.ColumnDefinitions>
+                        <ColumnDefinition Width="*"/>
+                        <ColumnDefinition Width="*"/>
+                    </Grid.ColumnDefinitions>
+                    
+                    
+                    <Grid Grid.Column="0"></Grid>
+
+                    <Grid Grid.Column="1">
+                        <StackPanel VerticalAlignment="Top" HorizontalAlignment="Center" Margin="20">
+                            <Button Content="Carrier Control" Foreground="Orange" Background="{x:Null}" FontSize="20"
                             VerticalAlignment="Top" Width="Auto" Height="50"
                             HorizontalAlignment="Left"/>
-                    
-                    <StackPanel Orientation="Horizontal"
+                        </StackPanel>
+                        
+                        <StackPanel Orientation="Horizontal"
                                 HorizontalAlignment="Center">
 
-                        <Button Margin="15" 
+                            <Button Margin="15" 
                                 Width="100" Height="100"
                                 Style="{StaticResource MaterialDesignRaisedButton}"
                                 materialDesign:ButtonAssist.CornerRadius="10"
                                 Command="{Binding PosMoveCommand}"
                                 CommandParameter="Lock">
-                            <StackPanel>
-                                <materialDesign:PackIcon Kind="ElectricSwitchClosed" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="42" Width="auto"/>
-                                <TextBlock Text="Lock" VerticalAlignment="Stretch" HorizontalAlignment="Center" />
-                            </StackPanel>
-                        </Button>
+                                <StackPanel>
+                                    <materialDesign:PackIcon Kind="ElectricSwitchClosed" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="42" Width="auto"/>
+                                    <TextBlock Text="Lock" VerticalAlignment="Stretch" HorizontalAlignment="Center" />
+                                </StackPanel>
+                            </Button>
 
-                        <Button Margin="15"
+                            <Button Margin="15"
                                 Width="100" Height="100"
                                 Style="{StaticResource MaterialDesignRaisedButton}"
                                 materialDesign:ButtonAssist.CornerRadius="10"
                                 Command="{Binding PosMoveCommand}"
                                 CommandParameter="UnLock">
-                            <StackPanel>
-                                <materialDesign:PackIcon Kind="ElectricSwitch" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="42" Width="auto"/>
-                                <TextBlock Text="UnLock" VerticalAlignment="Stretch" HorizontalAlignment="Center" />
-                            </StackPanel>
-                        </Button>
+                                <!--<Button.InputBindings>
+                                <MouseBinding Gesture="LeftClick" Command="{Binding KeyInTargetPosCommand}" CommandParameter="Left"/>
+                            </Button.InputBindings>-->
+                                <StackPanel>
+                                    <materialDesign:PackIcon Kind="ElectricSwitch" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="42" Width="auto"/>
+                                    <TextBlock Text="UnLock" VerticalAlignment="Stretch" HorizontalAlignment="Center" />
+                                </StackPanel>
+                            </Button>
 
-                    </StackPanel>
+                        </StackPanel>
+                    </Grid>
+
+                    
                 </Grid>
             </Grid>
         </Grid>
 
         <Grid Grid.Column="1" Background="#263238">
             <Border Margin="1" BorderBrush="#FF00FFD3" BorderThickness="2" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
-            <StackPanel>
-                <Button Margin="7,20" HorizontalAlignment="Stretch" Height="Auto" BorderBrush="Gray" BorderThickness="2" Command="{Binding CloseDialogCommand}" CommandParameter="true">
+            <StackPanel VerticalAlignment="Bottom">
+                <Button Margin="5,0,5,10" HorizontalAlignment="Stretch" Height="Auto" BorderBrush="Gray" BorderThickness="2" Command="{Binding CloseDialogCommand}" CommandParameter="true">
                     <StackPanel>
                         <materialDesign:PackIcon Kind="ExitToApp" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="42" Width="auto"/>
                         <TextBlock Text="Close" VerticalAlignment="Stretch" HorizontalAlignment="Center" />

+ 27 - 67
Dev/OHV/OHV.Module.Interactivity/PopUp/DriveServoView.xaml

@@ -142,8 +142,7 @@
 
                 <Button Grid.Column="0" Grid.Row="1" HorizontalAlignment="Stretch" Margin="5" Height="auto"
                             Style="{StaticResource MaterialDesignRaisedButton}"
-                            materialDesign:ButtonAssist.CornerRadius="10"
-                            ToolTip="MaterialDesignRaisedButton with Round Corners">
+                            materialDesign:ButtonAssist.CornerRadius="10">
                     <StackPanel>
                         <TextBlock HorizontalAlignment="Center"><Run Text="Target"/></TextBlock>
                         <TextBlock HorizontalAlignment="Center"><Run Text="Pos"/></TextBlock>
@@ -162,8 +161,7 @@
 
                 <Button Grid.Column="0" Grid.Row="3" HorizontalAlignment="Stretch" Margin="5" Height="auto"
                             Style="{StaticResource MaterialDesignRaisedButton}"
-                            materialDesign:ButtonAssist.CornerRadius="10"
-                            ToolTip="MaterialDesignRaisedButton with Round Corners">
+                            materialDesign:ButtonAssist.CornerRadius="10">
                     <StackPanel>
                         <TextBlock HorizontalAlignment="Center"><Run Text="Difference"/></TextBlock>
                         <TextBlock HorizontalAlignment="Center"><Run Text="Pos"/></TextBlock>
@@ -173,7 +171,6 @@
                 <Button Grid.Column="1" Grid.Row="0" HorizontalAlignment="Stretch" Margin="5" Height="auto"
                             Style="{StaticResource MaterialDesignRaisedButton}"
                             materialDesign:ButtonAssist.CornerRadius="10"
-                            ToolTip="MaterialDesignRaisedButton with Round Corners"
                             Command="{Binding SelectAxisCommand}"
                             CommandParameter="Left">
                     <TextBlock><Run Text="Drive1"/></TextBlock>
@@ -181,66 +178,25 @@
 
                 <Button Background="{x:Null}" Grid.Column="1" Grid.Row="1" HorizontalAlignment="Stretch" Margin="5" Height="auto"
                             Style="{StaticResource MaterialDesignRaisedButton}"
-                            materialDesign:ButtonAssist.CornerRadius="10"
-                            ToolTip="MaterialDesignRaisedButton with Round Corners">
+                            materialDesign:ButtonAssist.CornerRadius="10">
                     <Button.InputBindings>
                         <MouseBinding Gesture="LeftClick" Command="{Binding KeyInTargetPosCommand}" CommandParameter="Left"/>
                     </Button.InputBindings>
-                    <TextBlock><Run Text="{Binding TargetPosDrive, StringFormat=0.000, FallbackValue=0.000}"/></TextBlock>
+                    <TextBlock><Run Text="{Binding DriveTargetPos, StringFormat=0.000, FallbackValue=0.000}"/></TextBlock>
                 </Button>
 
                 <Button Background="{x:Null}" Grid.Column="1" Grid.Row="2" HorizontalAlignment="Stretch" Margin="5" Height="auto"
                             Style="{StaticResource MaterialDesignRaisedButton}"
-                            materialDesign:ButtonAssist.CornerRadius="10"
-                            ToolTip="MaterialDesignRaisedButton with Round Corners">
+                            materialDesign:ButtonAssist.CornerRadius="10">
                     <TextBlock><Run Text="{Binding CurrentDrive, StringFormat=0.000, FallbackValue=0.000}"/></TextBlock>
                 </Button>
 
                 <Button Background="{x:Null}" Grid.Column="1" Grid.Row="3" HorizontalAlignment="Stretch" Margin="5" Height="auto"
                             Style="{StaticResource MaterialDesignRaisedButton}"
-                            materialDesign:ButtonAssist.CornerRadius="10"
-                            ToolTip="MaterialDesignRaisedButton with Round Corners">
+                            materialDesign:ButtonAssist.CornerRadius="10">
                     <TextBlock><Run Text="{Binding DifferenceDrive, StringFormat=0.000, FallbackValue=0.000}"/></TextBlock>
                 </Button>
 
-                <!--Steering Dir Front-->
-                <!--<Button Grid.Column="3" Margin="10"
-                        Grid.Row="2"
-                        HorizontalAlignment="Stretch" 
-                        Height="Auto" 
-                        BorderBrush="Gray" 
-                        BorderThickness="2" 
-                        Command="{Binding SelectedDirection}"
-                        CommandParameter="Front">
-                    <StackPanel>
-                        -->
-                <!--<materialDesign:PackIcon Kind="SubdirectoryArrowLeft" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="42" Width="auto"/>-->
-                <!--
-                        <TextBlock Text="Steering" VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
-                        <TextBlock Text="Front" VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
-                    </StackPanel>
-                </Button>
-
-                -->
-                <!--Steering Dir Back-->
-                <!--
-                <Button Grid.Column="4" Margin="10"
-                        Grid.Row="2"
-                        HorizontalAlignment="Stretch" 
-                        Height="Auto" 
-                        BorderBrush="Gray" 
-                        BorderThickness="2" 
-                        Command="{Binding SelectedDirection}"
-                        CommandParameter="Back">
-                    <StackPanel>
-                        -->
-                <!--<materialDesign:PackIcon Kind="SubdirectoryArrowLeft" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="42" Width="auto"/>-->
-                <!--
-                        <TextBlock Text="Steering" VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
-                        <TextBlock Text="Back" VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
-                    </StackPanel>
-                </Button>-->
-
                 <Button Grid.Column="3" Margin="10,26,6,22"
                         Grid.Row="2"
                         HorizontalAlignment="Stretch" 
@@ -279,7 +235,7 @@
                             Height="auto"
                             Command="{Binding JogCommand}" CommandParameter="-">
                     <StackPanel>
-                        <materialDesign:PackIcon Kind="ArrowLeftBoldCircleOutline" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="30" Width="auto"/>
+                        <materialDesign:PackIcon Kind="MinusBoxOutline" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="30" Width="auto"/>
                         <TextBlock><Run Text="Jog(-)"/></TextBlock>
                     </StackPanel>
                 </RepeatButton>
@@ -293,7 +249,7 @@
                             Command="{Binding JogVelPopupCommand}" CommandParameter="-">
                     <StackPanel>
                         <TextBlock HorizontalAlignment="Center"><Run Text="Jog Velocity"/></TextBlock>
-                        <TextBlock HorizontalAlignment="Center"><Run Text="{Binding JogVelocity, StringFormat={}{0:0.000}, FallbackValue=0.000}"/></TextBlock>
+                        <TextBlock HorizontalAlignment="Center"><Run Text="{Binding JogVelocity, StringFormat={}{0:0.000}, FallbackValue=0.00}" Foreground="Orange"/></TextBlock>
                     </StackPanel>
                 </Button>
 
@@ -306,7 +262,7 @@
                             Height="auto"
                             Command="{Binding JogCommand}" CommandParameter="+">
                     <StackPanel>
-                        <materialDesign:PackIcon Kind="ArrowRightBoldCircleOutline" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="30" Width="auto"/>
+                        <materialDesign:PackIcon Kind="PlusBoxOutline" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="30" Width="auto"/>
                         <TextBlock><Run Text="Jog(+)"/></TextBlock>
                     </StackPanel>
                 </RepeatButton>
@@ -320,8 +276,8 @@
 
         <!--Sub Drive Menu-->
         <Grid Grid.Column="1" Background="#263238">
-            <StackPanel>
-                <Button Margin="7, 20" HorizontalAlignment="Stretch" Height="60" BorderBrush="Gray" BorderThickness="2" 
+            <StackPanel Orientation="Vertical" VerticalAlignment="Top">
+                <Button Margin="7, 10" HorizontalAlignment="Stretch" Height="60" BorderBrush="Gray" BorderThickness="2" 
                         Command="{Binding PositionAddCommand}">
                     <StackPanel>
                         <!--<materialDesign:PackIcon Kind="PowerSettings" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="42" Width="auto"/>-->
@@ -329,7 +285,7 @@
                     </StackPanel>
                 </Button>
 
-                <Button Margin="7, 20" HorizontalAlignment="Stretch" Height="60" BorderBrush="Gray" BorderThickness="2" 
+                <Button Margin="7, 10" HorizontalAlignment="Stretch" Height="60" BorderBrush="Gray" BorderThickness="2" 
                         Command="{Binding PositionDeleteCommand}">
                     <StackPanel>
                         <!--<materialDesign:PackIcon Kind="PowerSettings" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="42" Width="auto"/>-->
@@ -337,29 +293,31 @@
                     </StackPanel>
                 </Button>
 
-                <Button Margin="7, 20" HorizontalAlignment="Stretch" Height="60" BorderBrush="Gray" BorderThickness="2" 
+                <Button Margin="7, 10" HorizontalAlignment="Stretch" Height="60" BorderBrush="Gray" BorderThickness="2" 
                         Command="{Binding PositionSaveCommand}">
                     <StackPanel>
                         <!--<materialDesign:PackIcon Kind="PowerSettings" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="42" Width="auto"/>-->
                         <TextBlock Text="Save" VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
                     </StackPanel>
                 </Button>
+            </StackPanel>
 
-                <!--Move TO / Current To Target-->
-                <Button Margin="7, 50" HorizontalAlignment="Stretch" Height="60" BorderBrush="Gray" BorderThickness="2" 
-                        Command="{Binding MoveToCommand}">
+            <StackPanel Grid.Column="1" VerticalAlignment="Center" Orientation="Vertical"
+                        Margin="0,130,0,0">
+                <Button Margin="7" HorizontalAlignment="Stretch" Height="60" BorderBrush="Gray" BorderThickness="2" 
+                        Command="{Binding CurrentToTargetCommand}">
                     <StackPanel>
                         <!--<materialDesign:PackIcon Kind="PowerSettings" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="42" Width="auto"/>-->
-                        <TextBlock Text="Move To" VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
+                        <TextBlock Text="Current To" VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
+                        <TextBlock Text="Target" VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
                     </StackPanel>
                 </Button>
 
-                <Button Margin="7,0" HorizontalAlignment="Stretch" Height="60" BorderBrush="Gray" BorderThickness="2" 
-                        Command="{Binding CurrentToTargetCommand}">
+                <Button Margin="7" HorizontalAlignment="Stretch" Height="60" BorderBrush="Gray" BorderThickness="2" 
+                        Command="{Binding MoveToCommand}">
                     <StackPanel>
                         <!--<materialDesign:PackIcon Kind="PowerSettings" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="42" Width="auto"/>-->
-                        <TextBlock Text="Current To" VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
-                        <TextBlock Text="Target" VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
+                        <TextBlock Text="Move To" VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
                     </StackPanel>
                 </Button>
             </StackPanel>
@@ -367,8 +325,8 @@
 
         <!--Right Drive Menu-->
         <Grid Grid.Column="2" Background="#263238">
-            <Border Margin="1" BorderBrush="#FF00FFD3" BorderThickness="2" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
-            <StackPanel>
+            <Border Margin="1,1,0,1" BorderBrush="#FF00FFD3" BorderThickness="2" VerticalAlignment="Stretch" HorizontalAlignment="Left" Width="128"/>
+            <StackPanel VerticalAlignment="Top">
                 <Button Margin="5" HorizontalAlignment="Stretch" Height="Auto" BorderBrush="Gray" BorderThickness="2" Command="{Binding ServoOnCommand}">
                     <StackPanel>
                         <materialDesign:PackIcon Kind="PowerSettings" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="42" Width="auto"/>
@@ -396,7 +354,9 @@
                         <TextBlock Text="Origin" VerticalAlignment="Stretch" HorizontalAlignment="Center" />
                     </StackPanel>
                 </Button>
+            </StackPanel>
 
+            <StackPanel VerticalAlignment="Bottom">
                 <Button Margin="5" HorizontalAlignment="Stretch" Height="Auto" BorderBrush="Gray" BorderThickness="2" Command="{Binding CloseDialogCommand}" CommandParameter="true">
                     <StackPanel>
                         <materialDesign:PackIcon Kind="ExitToApp" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="42" Width="auto"/>

+ 115 - 65
Dev/OHV/OHV.Module.Interactivity/PopUp/DriveServoViewModel.cs

@@ -49,11 +49,11 @@ namespace OHV.Module.Interactivity.PopUp
         }
 
         #region Motor Left Binding Value
-        private double _targetPosDrive;
-        public double TargetPosDrive
+        private double _driveTargetPos;
+        public double DriveTargetPos
         {
-            get { return this._targetPosDrive; }
-            set { this.SetProperty(ref this._targetPosDrive, value); }
+            get { return this._driveTargetPos; }
+            set { this.SetProperty(ref this._driveTargetPos , value); }
         }
 
         private double _currentDrive;
@@ -126,17 +126,15 @@ namespace OHV.Module.Interactivity.PopUp
         public SqliteDAL.DAL.AxisPositionDataDAL axisPositionDataDal;
         SqliteManager sql;
         MessageController messageController;
-        //SelectionList selectionItems;
 
         public DriveServoViewModel(IEventAggregator _ea, SqliteManager _sql, MessageController _messageController)
         {
             this.eventAggregator = _ea;
-            this.eventAggregator.GetEvent<DirveControlPubSubEvent>().Unsubscribe(UICallbackCommunication);
-            this.eventAggregator.GetEvent<DirveControlPubSubEvent>().Subscribe(UICallbackCommunication, ThreadOption.UIThread);
+            this.eventAggregator.GetEvent<DriveControlPubSubEvent>().Unsubscribe(UICallbackCommunication);
+            this.eventAggregator.GetEvent<DriveControlPubSubEvent>().Subscribe(UICallbackCommunication, ThreadOption.UIThread);
 
             this.sql = _sql;
             this.RouteList = new ObservableCollection<Route>(sql.RouteDal.All);
-            /* Route 로 변경*/
 
             this.messageController = _messageController;
 
@@ -167,26 +165,39 @@ namespace OHV.Module.Interactivity.PopUp
             //TODO: Drive, Steering 구분
             if (args.EventDir == DriveControlEventArgs.eEventDir.ToFront)
             {
-                switch (args.ControlKind)
+                switch ( args.ControlKind )
                 {
                     case DriveControlEventArgs.eControlKind.MOVE:
                         break;
                     case DriveControlEventArgs.eControlKind.STOP:
                         break;
                     case DriveControlEventArgs.eControlKind.Steering:
-                        if (args.Result.IsSuccess)
+                        if ( args.Result.IsSuccess )
                         {
                             var dir = args.Result.ToResult<DriveControlEventArgs.eMoveDir>().Value;
-                            this.ChangeSteeringDirection(dir == DriveControlEventArgs.eMoveDir.LEFT ? true : false);
+                            this.ChangeSteeringDirection( dir == DriveControlEventArgs.eMoveDir.LEFT ? true : false );
                         }
                         break;
                     case DriveControlEventArgs.eControlKind.SteeringState:
-                        if (args.Result.IsSuccess)
+                        if ( args.Result.IsSuccess )
                         {
                             var dir = args.Result.ToResult<DriveControlEventArgs.eMoveDir>().Value;
-                            this.ChangeSteeringDirection(dir == DriveControlEventArgs.eMoveDir.LEFT ? true : false);
+                            this.ChangeSteeringDirection( dir == DriveControlEventArgs.eMoveDir.LEFT ? true : false );
                         }
                         break;
+                    case DriveControlEventArgs.eControlKind.ReqCurrentPos:
+                        this.CurrentDrive = args.CurrentPosition;
+                        break;
+                    case DriveControlEventArgs.eControlKind.ReqStopCurrentPos:
+                        break;
+                    case DriveControlEventArgs.eControlKind.FaultReset:
+                        break;
+                    case DriveControlEventArgs.eControlKind.DriveON:
+                        break;
+                    case DriveControlEventArgs.eControlKind.DriveOFF:
+                        break;
+                    case DriveControlEventArgs.eControlKind.JOG:
+                        break;
                     default:
                         break;
                 }
@@ -195,7 +206,7 @@ namespace OHV.Module.Interactivity.PopUp
 
         void PublishEvent(DriveControlEventArgs args)
         {
-            this.eventAggregator.GetEvent<DirveControlPubSubEvent>().Publish(args);
+            this.eventAggregator.GetEvent<DriveControlPubSubEvent>().Publish(args);
         }
 
         void ChangeSteeringDirection(bool isLeft)
@@ -215,12 +226,18 @@ namespace OHV.Module.Interactivity.PopUp
         #region Execute Method
         private void ExecuteJogCommand(object obj)
         {
-            if (obj.ToString().Equals("+"))
+            var msg = new DriveControlEventArgs
             {
-            }
+                EventDir = DriveControlEventArgs.eEventDir.ToBack,
+                ControlKind = DriveControlEventArgs.eControlKind.JOG,
+            };
+
+            if ( obj.ToString().Equals( "+" ) )
+                msg.JogDir = DriveControlEventArgs.eJogMoveDir.Positive;
             else
-            {
-            }
+                msg.JogDir = DriveControlEventArgs.eJogMoveDir.Negative;
+
+            this.PublishEvent( msg );
         }
 
         private void ExecuteJogVelPopupCommand()
@@ -270,98 +287,127 @@ namespace OHV.Module.Interactivity.PopUp
         private void ExecutePositionSaveCommand()
         {
             this.messageController.ShowConfirmationPopupView("Save To Data ?", r =>
-          {
+            {
               if (r.Result == ButtonResult.OK)
               {
-                  //value check 
-                  //1차 검사 ID 값이 동일한게 있는지 ?
-                  //2차 검사 Value 값 변화된것들이 있으면 변화된것들 Save 후 Update 해야함.
-                  var d = this.RouteList.ToList();
-                  var l = d.Distinct().ToList();
-
-                  //var saveData = new ObservableCollection<AxisPositionData>();
-
+                    //TODO:[20/03/18 ys-hwang] DB Table Update
               }
-          });
+            });
         }
 
         private void ExecutePositionDeleteCommand()
         {
-            var deleteList = new List<Route>();
-
-            foreach (var item in this.RouteList)
+            this.messageController.ShowConfirmationPopupView( "Select To Delete ?" , r =>
             {
-                if (item.IsSelected)
-                    deleteList.Add(item);
-            }
-            deleteList.ForEach(x => { this.RouteList.Remove(x); });
+                if ( r.Result == ButtonResult.OK )
+                {
+                    var deleteList = new List<Route>();
+
+                    foreach ( var item in this.RouteList )
+                    {
+                        if ( item.IsSelected )
+                            deleteList.Add( item );
+                    }
+                    deleteList.ForEach( x => { this.RouteList.Remove( x ); } );
+                }
+            } );
         }
 
         private void ExecutePositionAddCommand()
         {
-            this.RouteList.Add(new Route());
+            this.messageController.ShowConfirmationPopupView( "Position Add ?" , r =>
+            {
+                if ( r.Result == ButtonResult.OK )
+                {
+                    this.RouteList.Add( new Route() );
+
+                    this.messageController.ShowNotificationView( "Success" );
+                }
+            } );
         }
 
         private void ExecuteKeyInCommadn(object obj)
         {
             var numPad = new CalcuratorView();
-            var result = numPad.ShowDialog(this.TargetPosDrive);
-            this.TargetPosDrive = result;
+            var result = numPad.ShowDialog(this.DriveTargetPos );
+            this.DriveTargetPos = result;
         }
 
         private void ExecuteOriginCommand()
         {
-            //this.SelectAxis.OriginReturn();
+            this.messageController.ShowConfirmationPopupView( "Origin ?" , r =>
+            {
+                if ( r.Result == ButtonResult.OK )
+                {
+                    //TODO: How to use
+                }
+            } );
         }
 
         private void ExecuteFaultResetCommand()
         {
-            //this.SelectAxis.FaultReset()
+            var msg = new DriveControlEventArgs
+            {
+                EventDir = DriveControlEventArgs.eEventDir.ToBack ,
+                ControlKind = DriveControlEventArgs.eControlKind.FaultReset ,
+            };
+
+            this.PublishEvent( msg );
         }
 
         private void ExecuteServoOffCommand()
         {
-            //this.SelectAxis.ServoOff();
+            var msg = new DriveControlEventArgs
+            {
+                EventDir = DriveControlEventArgs.eEventDir.ToBack ,
+                ControlKind = DriveControlEventArgs.eControlKind.DriveOFF ,
+            };
+
+            this.PublishEvent( msg );
         }
 
         private void ExecuteServoOnCommand()
         {
-            //this.SelectAxis.ServoOn();
+            var msg = new DriveControlEventArgs
+            {
+                EventDir = DriveControlEventArgs.eEventDir.ToBack ,
+                ControlKind = DriveControlEventArgs.eControlKind.DriveON ,
+            };
+
+            this.PublishEvent( msg );
         }
 
         private void ExecuteCurrentToTargetCommand()
         {
-            this.TargetPosDrive = this.CurrentDrive;
+            this.messageController.ShowConfirmationPopupView( "Current To Target ?" , r =>
+            {
+                if ( r.Result == ButtonResult.OK )
+                {
+                    this.DriveTargetPos = this.CurrentDrive;
+                }
+            } );
         }
 
-        private async void ExecuteMoveToCommand()
+        private void ExecuteMoveToCommand()
         {
-            await Task.Run(() =>
-           {
-               //Axis.Move(this.SelectPosition);
-           });
+            this.messageController.ShowConfirmationPopupView( "Move To Pos ?" , r =>
+            {
+                if ( r.Result == ButtonResult.OK )
+                {
+                    var msg = new DriveControlEventArgs
+                    {
+                        EventDir = DriveControlEventArgs.eEventDir.ToBack ,
+                        ControlKind = DriveControlEventArgs.eControlKind.MOVE ,
+                    };
+
+                    this.PublishEvent( msg );
+                }
+            } );
         }
 
         private void ExecuteSelectPosCommand(object obj)
         {
             this.SelectedPosition = obj.ToString();
-
-            switch (this.SelectedPosition)
-            {
-                case "P1":
-                    break;
-                case "P2":
-                    break;
-                case "P3":
-                    break;
-                case "P4":
-                    break;
-                case "P5":
-                    break;
-
-                default:
-                    break;
-            }
         }
 
         #endregion
@@ -374,6 +420,8 @@ namespace OHV.Module.Interactivity.PopUp
 
         public void OnDialogClosed()
         {
+            this.eventAggregator.GetEvent<DriveControlPubSubEvent>().Publish( new DriveControlEventArgs { EventDir = DriveControlEventArgs.eEventDir.ToBack , ControlKind = DriveControlEventArgs.eControlKind.ReqStopCurrentPos } );
+            this.eventAggregator.GetEvent<DriveControlPubSubEvent>().Unsubscribe( UICallbackCommunication );
         }
 
         public void OnDialogOpened(IDialogParameters parameters)
@@ -384,6 +432,8 @@ namespace OHV.Module.Interactivity.PopUp
                 ControlKind = DriveControlEventArgs.eControlKind.SteeringState,
             };
             this.PublishEvent(msg);
+
+            this.eventAggregator.GetEvent<DriveControlPubSubEvent>().Publish( new DriveControlEventArgs { EventDir = DriveControlEventArgs.eEventDir.ToBack , ControlKind = DriveControlEventArgs.eControlKind.ReqCurrentPos } );
         }
 
         private void CloseDialog(string parameter)

+ 4 - 0
Dev/OHV/OHV.Module.Interactivity/PopUp/OpticalReadingConfigView.xaml

@@ -250,6 +250,10 @@
                 <Button Background="{x:Null}" Height="60"
                         Command="{Binding PatternResultKyein}"
                         CommandParameter="C">
+                    <!--<Button.InputBindings>
+                        <MouseBinding Gesture="LeftClick" Command="{Binding KeyInTargetPosCommand}" CommandParameter="Left"/>
+                    </Button.InputBindings>-->
+                    
                     <StackPanel>
                         <TextBlock><Run Text="{Binding CurvePatternResult, FallbackValue=0}" FontSize="25" Foreground="Orange"/></TextBlock>
                     </StackPanel>

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

@@ -3,6 +3,8 @@ using System.Collections;
 using System.Collections.Generic;
 using System.Linq;
 using System.Threading;
+using System.Threading.Tasks;
+using FluentResults;
 using GSG.NET.Concurrent;
 using GSG.NET.LINQ;
 using GSG.NET.Logging;
@@ -119,6 +121,7 @@ namespace VehicleControlSystem.ControlLayer
         #endregion
 
         ThreadCancel cancel = new ThreadCancel();
+        TaskCancel taskCancel = new TaskCancel();
 
         private eObstacleState obstacleState = eObstacleState.Normal;
         public eObstacleState ObstacleStateProperty
@@ -154,16 +157,16 @@ namespace VehicleControlSystem.ControlLayer
 
             this.eventAggregator = ea;
 
-            this.eventAggregator.GetEvent<DirveControlPubSubEvent>().Unsubscribe( ReceiveDriveControlEvent );
-            this.eventAggregator.GetEvent<DirveControlPubSubEvent>().Subscribe( ReceiveDriveControlEvent );
+            this.eventAggregator.GetEvent<DriveControlPubSubEvent>().Unsubscribe( ReceiveDriveControlEvent );
+            this.eventAggregator.GetEvent<DriveControlPubSubEvent>().Subscribe( ReceiveDriveControlEvent );
         }
 
-        private void ReceiveDriveControlEvent( DriveControlEventArgs obj )
+        private void ReceiveDriveControlEvent( DriveControlEventArgs _args )
         {
             if ( this.autoManager.OperationModeProperty != eOperatationMode.ManualMode )
                 return;
 
-            var msg = obj;
+            var msg = _args;
             if ( msg.EventDir == DriveControlEventArgs.eEventDir.ToBack )
             {
                 switch ( msg.ControlKind )
@@ -189,6 +192,25 @@ namespace VehicleControlSystem.ControlLayer
                             this.DriveControlEventPublish( reply );
                         }
                         break;
+                    case DriveControlEventArgs.eControlKind.ReqCurrentPos:
+                        this.ReqCurrentPos();
+                        break;
+                    case DriveControlEventArgs.eControlKind.ReqStopCurrentPos:
+                        this.taskCancel.Cancel();
+                        this.taskCancel.WaitAll();
+                        break;
+                    case DriveControlEventArgs.eControlKind.FaultReset:
+                        this.ReqFaultReset( _args );
+                        break;
+                    case DriveControlEventArgs.eControlKind.DriveON:
+                        this.ReqDriveOn( _args );
+                        break;
+                    case DriveControlEventArgs.eControlKind.DriveOFF:
+                        this.ReqDriveOff( _args );
+                        break;
+                    case DriveControlEventArgs.eControlKind.JOG:
+                        this.ReqJog( _args );
+                        break;
                     default:
                         break;
                 }
@@ -198,7 +220,7 @@ namespace VehicleControlSystem.ControlLayer
         private void DriveControlEventPublish( DriveControlEventArgs args )
         {
             args.EventDir = DriveControlEventArgs.eEventDir.ToFront;
-            this.eventAggregator.GetEvent<DirveControlPubSubEvent>().Publish( args );
+            this.eventAggregator.GetEvent<DriveControlPubSubEvent>().Publish( args );
         }
 
         public void Init()
@@ -229,6 +251,88 @@ namespace VehicleControlSystem.ControlLayer
             this.cancel.StopWaitAll();
         }
 
+        #region Request Method
+        void ReqFaultReset(DriveControlEventArgs _args)
+        {
+            //TODO:[20/03/18 ys-hwang] Drive Assign
+            var drive = 0;
+
+            //var result = drive.ResetAmpFault();
+
+            var msg = new DriveControlEventArgs
+            {
+
+            };
+
+            msg.Result = Results.Ok( "Drive On" );
+            this.DriveControlEventPublish( msg );
+        }
+
+        void ReqJog(DriveControlEventArgs _args)
+        {
+            //TODO:[20/03/18 ys-hwang] Drive Jog Request
+            var drive = string.Empty;
+            
+            if ( _args.JogDir == DriveControlEventArgs.eJogMoveDir.Positive )
+                drive = "POSITIVE";
+            else
+                drive = "NEGATIVE";
+        }
+
+        void ReqCurrentPos()
+        {
+            //TODO:[20/03/18 ys-hwang] Drive Current Position Publish
+
+            var task = Task.Factory.StartNew( ( ) =>
+             {
+                 while(!this.taskCancel.Canceled)
+                 {
+                     LockUtils.Wait( 500 );
+
+                     var msg = new DriveControlEventArgs
+                     {
+                         EventDir = DriveControlEventArgs.eEventDir.ToFront ,
+                         ControlKind = DriveControlEventArgs.eControlKind.ReqCurrentPos ,
+                         //CurrentPosition = drive.CurrentPosition,
+                     };
+                     
+                     //this.DriveControlEventPublish( msg );
+                 }
+             } );
+
+            this.taskCancel.Add( task );
+        }
+
+        void ReqDriveOn( DriveControlEventArgs _args)
+        {
+            //TODO:[20/03/18 ys-hwang] Drive On
+            var drive = "Drive Name";
+            //drive.On();
+
+            var msg = new DriveControlEventArgs
+            {
+
+            };
+            msg.Result = Results.Ok( "Drive On" );
+
+            this.DriveControlEventPublish( msg );
+        }
+
+        void ReqDriveOff( DriveControlEventArgs _args)
+        {
+            var drive = "Drive Name";
+            //drive.Off();
+
+            var msg = new DriveControlEventArgs
+            {
+                
+            };
+            msg.Result = Results.Ok( "Drive On" );
+
+            this.DriveControlEventPublish( msg );
+        }
+        #endregion
+
         #region Thread
         void ThreadStart()
         {
@@ -1021,7 +1125,7 @@ namespace VehicleControlSystem.ControlLayer
                     Result = FluentResults.Results.Ok<DriveControlEventArgs.eMoveDir>( DriveControlEventArgs.eMoveDir.LEFT ),
                 };
 
-                this.eventAggregator.GetEvent<DirveControlPubSubEvent>().Publish( msg );
+                this.eventAggregator.GetEvent<DriveControlPubSubEvent>().Publish( msg );
             }
 
         }