|
|
@@ -21,7 +21,7 @@ namespace OHV.Module.Interactivity.PopUp
|
|
|
{
|
|
|
private DelegateCommand<string> _closeDialogCommand;
|
|
|
public DelegateCommand<string> CloseDialogCommand =>
|
|
|
- _closeDialogCommand ?? (_closeDialogCommand = new DelegateCommand<string>(CloseDialog));
|
|
|
+ _closeDialogCommand ?? ( _closeDialogCommand = new DelegateCommand<string>( CloseDialog ) );
|
|
|
|
|
|
private string _title = "DriveServoView";
|
|
|
public string Title
|
|
|
@@ -29,7 +29,7 @@ namespace OHV.Module.Interactivity.PopUp
|
|
|
get { return this._title; }
|
|
|
set
|
|
|
{
|
|
|
- this.SetProperty(ref this._title, value);
|
|
|
+ this.SetProperty( ref this._title, value );
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -39,7 +39,7 @@ namespace OHV.Module.Interactivity.PopUp
|
|
|
get => this._selectedPosition;
|
|
|
set
|
|
|
{
|
|
|
- this.SetProperty(ref this._selectedPosition, value);
|
|
|
+ this.SetProperty( ref this._selectedPosition, value );
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -47,7 +47,7 @@ namespace OHV.Module.Interactivity.PopUp
|
|
|
public string SelectDirection
|
|
|
{
|
|
|
get => this._selectDirection;
|
|
|
- set { this.SetProperty(ref this._selectDirection, value); }
|
|
|
+ set { this.SetProperty( ref this._selectDirection, value ); }
|
|
|
}
|
|
|
|
|
|
#region Motor Left Binding Value
|
|
|
@@ -55,33 +55,37 @@ namespace OHV.Module.Interactivity.PopUp
|
|
|
public double DriveTargetPos
|
|
|
{
|
|
|
get { return this._driveTargetPos; }
|
|
|
- set { this.SetProperty(ref this._driveTargetPos , value); }
|
|
|
+ set { this.SetProperty( ref this._driveTargetPos, value ); }
|
|
|
}
|
|
|
|
|
|
- private double _currentDrive;
|
|
|
- public double CurrentDrive
|
|
|
+ private double _currentPosition;
|
|
|
+ /// <summary>
|
|
|
+ /// * Drive Current Position
|
|
|
+ /// </summary>
|
|
|
+ public double CurrentPosition
|
|
|
{
|
|
|
- get { return this._currentDrive; }
|
|
|
- set { this.SetProperty(ref this._currentDrive, value); }
|
|
|
+ get { return this._currentPosition; }
|
|
|
+ set { this.SetProperty( ref this._currentPosition, value ); }
|
|
|
}
|
|
|
|
|
|
private double _differenceDrive;
|
|
|
public double DifferenceDrive
|
|
|
{
|
|
|
get { return this._differenceDrive; }
|
|
|
- set { this.SetProperty(ref this._differenceDrive, value); }
|
|
|
+ set { this.SetProperty( ref this._differenceDrive, value ); }
|
|
|
}
|
|
|
|
|
|
- private double _jogVelocity;
|
|
|
+ private double _jogVelocity = 5;
|
|
|
public double JogVelocity
|
|
|
{
|
|
|
get { return this._jogVelocity; }
|
|
|
- set { this.SetProperty(ref this._jogVelocity, value); }
|
|
|
+ set { this.SetProperty( ref this._jogVelocity, value ); }
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
public event Action<IDialogResult> RequestClose;
|
|
|
|
|
|
+ #region Commands
|
|
|
public ICommand SelectAxisCommand { get; set; }
|
|
|
public ICommand KeyInTargetPosCommand { get; set; }
|
|
|
public ICommand SelectPosCommand { get; set; }
|
|
|
@@ -96,25 +100,25 @@ namespace OHV.Module.Interactivity.PopUp
|
|
|
public ICommand PositionAddCommand { get; set; }
|
|
|
public ICommand PositionDeleteCommand { get; set; }
|
|
|
public ICommand PositionSaveCommand { get; set; }
|
|
|
- public ICommand SteeringCWCommand { get; set; }
|
|
|
- public ICommand SteeringCCWCommand { get; set; }
|
|
|
+ public ICommand SteeringMoveCommand { get; set; }
|
|
|
public ICommand SelectedDirection { get; set; }
|
|
|
public ICommand JogVelPopupCommand { get; set; }
|
|
|
- public ICommand JogCommand { get; set; }
|
|
|
+ public ICommand JogCommand { get; set; }
|
|
|
+ #endregion
|
|
|
|
|
|
#region Brushes
|
|
|
private Brush steeringLeftBrush = Brushes.Gray;
|
|
|
public Brush SteeringLeftBrushProperty
|
|
|
{
|
|
|
get { return steeringLeftBrush; }
|
|
|
- set { SetProperty(ref this.steeringLeftBrush, value); }
|
|
|
+ set { SetProperty( ref this.steeringLeftBrush, value ); }
|
|
|
}
|
|
|
|
|
|
private Brush steeringRightBrush = Brushes.Gray;
|
|
|
public Brush SteeringRightBrushProperty
|
|
|
{
|
|
|
get { return steeringRightBrush; }
|
|
|
- set { SetProperty(ref this.steeringRightBrush, value); }
|
|
|
+ set { SetProperty( ref this.steeringRightBrush, value ); }
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
@@ -122,92 +126,110 @@ namespace OHV.Module.Interactivity.PopUp
|
|
|
public ObservableCollection<Route> RouteList
|
|
|
{
|
|
|
get { return this._routeList; }
|
|
|
- set { SetProperty(ref this._routeList, value); }
|
|
|
+ set { SetProperty( ref this._routeList, value ); }
|
|
|
}
|
|
|
|
|
|
public SqliteDAL.DAL.AxisPositionDataDAL axisPositionDataDal;
|
|
|
SqliteManager sql;
|
|
|
MessageController messageController;
|
|
|
|
|
|
- public DriveServoViewModel(IEventAggregator _ea, SqliteManager _sql, MessageController _messageController)
|
|
|
+ public DriveServoViewModel( IEventAggregator _ea, SqliteManager _sql, MessageController _messageController )
|
|
|
{
|
|
|
this.eventAggregator = _ea;
|
|
|
this.eventAggregator.GetEvent<DriveControlPubSubEvent>().Unsubscribe( DriveControlCallBack );
|
|
|
- this.eventAggregator.GetEvent<DriveControlPubSubEvent>().Subscribe( DriveControlCallBack , ThreadOption.UIThread );
|
|
|
+ this.eventAggregator.GetEvent<DriveControlPubSubEvent>().Subscribe( DriveControlCallBack, ThreadOption.UIThread );
|
|
|
|
|
|
- /*상태 회신을 받기 위함*/
|
|
|
this.eventAggregator.GetEvent<GUIMessagePubSubEvent>().Unsubscribe( UICallBackCommunication );
|
|
|
- this.eventAggregator.GetEvent<GUIMessagePubSubEvent>().Subscribe( UICallBackCommunication , ThreadOption.UIThread );
|
|
|
+ this.eventAggregator.GetEvent<GUIMessagePubSubEvent>().Subscribe( UICallBackCommunication, ThreadOption.UIThread );
|
|
|
|
|
|
this.sql = _sql;
|
|
|
- this.RouteList = new ObservableCollection<Route>(sql.RouteDal.All);
|
|
|
|
|
|
this.messageController = _messageController;
|
|
|
|
|
|
- this.SelectPosCommand = new DelegateCommand<object>(ExecuteSelectPosCommand);
|
|
|
- this.MoveToCommand = new DelegateCommand(ExecuteMoveToCommand);
|
|
|
- this.CurrentToTargetCommand = new DelegateCommand(ExecuteCurrentToTargetCommand);
|
|
|
- this.KeyInTargetPosCommand = new DelegateCommand<object>(ExecuteKeyInCommadn);
|
|
|
+ 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.ServoOnCommand = new DelegateCommand(ExecuteServoOnCommand);
|
|
|
- this.ServoOffCommand = new DelegateCommand(ExecuteServoOffCommand);
|
|
|
- this.FaultResetCommand = new DelegateCommand(ExecuteFaultResetCommand);
|
|
|
- this.OriginCommand = new DelegateCommand(ExecuteOriginCommand);
|
|
|
+ this.PositionAddCommand = new DelegateCommand( ExecutePositionAddCommand );
|
|
|
+ this.PositionDeleteCommand = new DelegateCommand( ExecutePositionDeleteCommand );
|
|
|
+ this.PositionSaveCommand = new DelegateCommand( ExecutePositionSaveCommand );
|
|
|
|
|
|
- this.PositionAddCommand = new DelegateCommand(ExecutePositionAddCommand);
|
|
|
- this.PositionDeleteCommand = new DelegateCommand(ExecutePositionDeleteCommand);
|
|
|
- this.PositionSaveCommand = new DelegateCommand(ExecutePositionSaveCommand);
|
|
|
+ this.SelectedDirection = new DelegateCommand<object>( ExecuteSelectedDirection );
|
|
|
+ this.SteeringMoveCommand = new DelegateCommand<object>( ExecuteSteeringMove );
|
|
|
+
|
|
|
+ this.JogVelPopupCommand = new DelegateCommand( ExecuteJogVelPopupCommand );
|
|
|
+ this.JogCommand = new DelegateCommand<object>( ExecuteJogCommand );
|
|
|
+ }
|
|
|
|
|
|
- this.SelectedDirection = new DelegateCommand<object>(ExecuteSelectedDirection);
|
|
|
- this.SteeringCWCommand = new DelegateCommand<object>(ExecuteSteeringCWCommand);
|
|
|
- this.SteeringCCWCommand = new DelegateCommand<object>(ExecuteSteeringCCWCommand);
|
|
|
+ private void ExecuteSteeringMove( object obj )
|
|
|
+ {
|
|
|
+ var msg = new DriveControlEventArgs
|
|
|
+ {
|
|
|
+ EventDir = DriveControlEventArgs.eEventDir.ToBack ,
|
|
|
+ ControlKind = DriveControlEventArgs.eControlKind.Steering ,
|
|
|
+ };
|
|
|
+
|
|
|
+ if ( obj.ToString().Equals( "CW" ) )
|
|
|
+ msg.MoveDir = DriveControlEventArgs.eMoveDir.LEFT;
|
|
|
+ else
|
|
|
+ msg.MoveDir = DriveControlEventArgs.eMoveDir.RIGHT;
|
|
|
|
|
|
- this.JogVelPopupCommand = new DelegateCommand(ExecuteJogVelPopupCommand);
|
|
|
- this.JogCommand = new DelegateCommand<object>(ExecuteJogCommand);
|
|
|
+ this.PublishEvent( msg );
|
|
|
}
|
|
|
|
|
|
private void UICallBackCommunication( GUIMessageEventArgs obj )
|
|
|
{
|
|
|
- //Property 상태가 바뀔때 마다 표현만 하면 된다?
|
|
|
if ( obj.Kind == GUIMessageEventArgs.eGUIMessageKind.ModelPropertyChange )
|
|
|
{
|
|
|
if ( obj.MessageKey.Equals( MessageKey.Vehicle ) )
|
|
|
{
|
|
|
switch ( obj.ModelPropertyName )
|
|
|
{
|
|
|
+ //변화될때 들어오는지 확인
|
|
|
case "SteeringState":
|
|
|
{
|
|
|
var dir = CastTo<eSteeringState>.From<object>( obj.Args );
|
|
|
this.ChangeSteeringDirection( dir );
|
|
|
}
|
|
|
break;
|
|
|
-<<<<<<< HEAD
|
|
|
case "VehicleStateProperty":
|
|
|
{
|
|
|
var v = CastTo<eVehicleState>.From<object>( obj.Args );
|
|
|
this.ChagneVehicleState( v );
|
|
|
}
|
|
|
break;
|
|
|
- case "ObstacleStateProperty":
|
|
|
- break;
|
|
|
-=======
|
|
|
case "CurrentPosition":
|
|
|
{
|
|
|
- var v = CastTo<double>.From<object>(obj.Args);
|
|
|
+ var v = CastTo<double>.From<object>( obj.Args );
|
|
|
+ this.CurrentPosition = v;
|
|
|
}
|
|
|
break;
|
|
|
->>>>>>> 944428eda961c69237f00f4b0ce920edb41b0a2e
|
|
|
+ case "CurrentTag":
|
|
|
+ break;
|
|
|
+ case "CurrentSpeed":
|
|
|
+ break;
|
|
|
+ case "CurrentTorque":
|
|
|
+ break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ if ( obj.Kind == GUIMessageEventArgs.eGUIMessageKind.RspRouteManager )
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void ChagneVehicleState( eVehicleState v )
|
|
|
{
|
|
|
- //TODO:[20/03/20 ys-hwang] Vehicle Manual Move 할때? 상태를 보고 해야?, 아니면 Manual 이니까????
|
|
|
- // 아니면 busy 상태 확인만 ?
|
|
|
switch ( v )
|
|
|
{
|
|
|
case eVehicleState.None:
|
|
|
@@ -231,35 +253,46 @@ namespace OHV.Module.Interactivity.PopUp
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void DriveControlCallBack( DriveControlEventArgs args)
|
|
|
+ private void DriveControlCallBack( DriveControlEventArgs args )
|
|
|
{
|
|
|
- //TODO:[20/03/19 ys-hwang] Drive UI return msg popup
|
|
|
-
|
|
|
- if (args.EventDir == DriveControlEventArgs.eEventDir.ToFront)
|
|
|
+ if ( args.EventDir == DriveControlEventArgs.eEventDir.ToFront )
|
|
|
{
|
|
|
switch ( args.ControlKind )
|
|
|
{
|
|
|
case DriveControlEventArgs.eControlKind.MOVE:
|
|
|
- ResponseMove(args);
|
|
|
+ ResponseMove( args );
|
|
|
break;
|
|
|
case DriveControlEventArgs.eControlKind.STOP:
|
|
|
break;
|
|
|
case DriveControlEventArgs.eControlKind.Steering:
|
|
|
+<<<<<<< HEAD
|
|
|
+ //response 주석 처리
|
|
|
+ if ( args.Result.IsSuccess )
|
|
|
+ {
|
|
|
+ var dir = args.Result.ToResult<eSteeringState>().Value;
|
|
|
+ this.ChangeSteeringDirection( dir );
|
|
|
+ }
|
|
|
+=======
|
|
|
//if ( args.Result.IsSuccess )
|
|
|
//{
|
|
|
- // var dir = args.Result.ToResult<DriveControlEventArgs.eMoveDir>().Value;
|
|
|
- // this.ChangeSteeringDirection( dir == DriveControlEventArgs.eMoveDir.LEFT ? true : false );
|
|
|
+ // var dir = args.Result.ToResult<eSteeringState>().Value;
|
|
|
+ // this.ChangeSteeringDirection( dir );
|
|
|
//}
|
|
|
+>>>>>>> 5102bdb09d0f6db0d065bbce661dff3a85fda270
|
|
|
break;
|
|
|
case DriveControlEventArgs.eControlKind.SteeringState:
|
|
|
- //if ( args.Result.IsSuccess )
|
|
|
- //{
|
|
|
- // var dir = args.Result.ToResult<DriveControlEventArgs.eMoveDir>().Value;
|
|
|
- // this.ChangeSteeringDirection( dir == DriveControlEventArgs.eMoveDir.LEFT ? true : false );
|
|
|
- //}
|
|
|
+ if ( args.Result.IsSuccess )
|
|
|
+ {
|
|
|
+ var dir = CastTo<eSteeringState>.From<object>( args.Args );
|
|
|
+ this.ChangeSteeringDirection( dir );
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ this.ChangeSteeringDirection( eSteeringState.None );
|
|
|
+ }
|
|
|
break;
|
|
|
case DriveControlEventArgs.eControlKind.ReqCurrentPos:
|
|
|
- this.CurrentDrive = args.CurrentPosition;
|
|
|
+ this.CurrentPosition = args.CurrentPosition;
|
|
|
break;
|
|
|
case DriveControlEventArgs.eControlKind.ReqStopCurrentPos:
|
|
|
break;
|
|
|
@@ -271,45 +304,56 @@ namespace OHV.Module.Interactivity.PopUp
|
|
|
break;
|
|
|
case DriveControlEventArgs.eControlKind.JOG:
|
|
|
break;
|
|
|
+ case DriveControlEventArgs.eControlKind.VehicleState:
|
|
|
+ ResponseVehicleState( args );
|
|
|
+ break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void ResponseVehicleState( DriveControlEventArgs args )
|
|
|
+ {
|
|
|
+ var state = CastTo<VehicleInfo>.From<object>( args.Args );
|
|
|
+
|
|
|
+ this.CurrentPosition = state.CurrentPosition;
|
|
|
+ }
|
|
|
+
|
|
|
private void ResponseMove( DriveControlEventArgs args )
|
|
|
{
|
|
|
var msg = string.Empty;
|
|
|
- if(args.Result.IsSuccess)
|
|
|
+ if ( args.Result.IsSuccess )
|
|
|
{
|
|
|
- msg = "Move Successs";
|
|
|
+ msg = "Move Success";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var error = args.Result.Errors.FirstOrDefault();
|
|
|
- var alarm = error.Metadata[ "Alarm" ] as Alarm;
|
|
|
+ var alarm = error.Metadata["Alarm"] as Alarm;
|
|
|
msg = alarm.Name + " " + alarm.Text;
|
|
|
}
|
|
|
|
|
|
this.messageController.ShowNotificationView( msg );
|
|
|
}
|
|
|
|
|
|
- void PublishEvent(DriveControlEventArgs args)
|
|
|
+ void PublishEvent( DriveControlEventArgs args )
|
|
|
{
|
|
|
- this.eventAggregator.GetEvent<DriveControlPubSubEvent>().Publish(args);
|
|
|
+ args.EventDir = DriveControlEventArgs.eEventDir.ToBack;
|
|
|
+ this.eventAggregator.GetEvent<DriveControlPubSubEvent>().Publish( args );
|
|
|
}
|
|
|
|
|
|
- void ChangeSteeringDirection(eSteeringState state)
|
|
|
+ void ChangeSteeringDirection( eSteeringState state )
|
|
|
{
|
|
|
if ( state == eSteeringState.Left )
|
|
|
{
|
|
|
- this.SteeringLeftBrushProperty = ( System.Windows.Media.Brush )new System.Windows.Media.BrushConverter().ConvertFromString( "#FF00FFD3" );
|
|
|
+ this.SteeringLeftBrushProperty = (Brush)new BrushConverter().ConvertFromString( "#FF00FFD3" );
|
|
|
this.SteeringRightBrushProperty = Brushes.Gray;
|
|
|
}
|
|
|
else if ( state == eSteeringState.Right )
|
|
|
{
|
|
|
this.SteeringLeftBrushProperty = Brushes.Gray;
|
|
|
- this.SteeringRightBrushProperty = ( System.Windows.Media.Brush )new System.Windows.Media.BrushConverter().ConvertFromString( "#FF00FFD3" );
|
|
|
+ this.SteeringRightBrushProperty = (Brush)new BrushConverter().ConvertFromString( "#FF00FFD3" );
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -319,8 +363,14 @@ namespace OHV.Module.Interactivity.PopUp
|
|
|
}
|
|
|
|
|
|
#region Execute Method
|
|
|
- private void ExecuteJogCommand(object obj)
|
|
|
+ private void ExecuteJogCommand( object obj )
|
|
|
{
|
|
|
+ if ( this.JogVelocity <= 0 )
|
|
|
+ {
|
|
|
+ this.messageController.ShowNotificationView( "Check Jog Velocity" );
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
var msg = new DriveControlEventArgs
|
|
|
{
|
|
|
EventDir = DriveControlEventArgs.eEventDir.ToBack,
|
|
|
@@ -338,114 +388,90 @@ namespace OHV.Module.Interactivity.PopUp
|
|
|
private void ExecuteJogVelPopupCommand()
|
|
|
{
|
|
|
var numPad = new CalcuratorView();
|
|
|
- var result = numPad.ShowDialog(this.JogVelocity);
|
|
|
+ var result = numPad.ShowDialog( this.JogVelocity );
|
|
|
|
|
|
this.JogVelocity = result;
|
|
|
}
|
|
|
|
|
|
- private void ExecuteSelectedDirection(object obj)
|
|
|
+ private void ExecuteSelectedDirection( object obj )
|
|
|
{
|
|
|
this.SelectDirection = obj.ToString();
|
|
|
}
|
|
|
|
|
|
- private void ExecuteSteeringCCWCommand(object obj)
|
|
|
- {
|
|
|
- var msg = new DriveControlEventArgs
|
|
|
- {
|
|
|
- EventDir = DriveControlEventArgs.eEventDir.ToBack,
|
|
|
- ControlKind = DriveControlEventArgs.eControlKind.Steering,
|
|
|
- };
|
|
|
-
|
|
|
- if (obj.ToString().Equals("CCW"))
|
|
|
- msg.MoveDir = DriveControlEventArgs.eMoveDir.RIGHT;
|
|
|
- else
|
|
|
- msg.MoveDir = DriveControlEventArgs.eMoveDir.LEFT;
|
|
|
-
|
|
|
- this.PublishEvent(msg);
|
|
|
- }
|
|
|
|
|
|
- private void ExecuteSteeringCWCommand(object obj)
|
|
|
+ private void ExecutePositionSaveCommand()
|
|
|
{
|
|
|
- var msg = new DriveControlEventArgs
|
|
|
- {
|
|
|
- EventDir = DriveControlEventArgs.eEventDir.ToBack,
|
|
|
- ControlKind = DriveControlEventArgs.eControlKind.Steering,
|
|
|
- };
|
|
|
+ this.messageController.ShowConfirmationPopupView( "Save To Data ?", r =>
|
|
|
+ {
|
|
|
+ if ( r.Result == ButtonResult.OK )
|
|
|
+ {
|
|
|
+ var result = this.RouteList.Any( x => x.IsSelected != false );
|
|
|
|
|
|
- if (obj.ToString().Equals("CW"))
|
|
|
- msg.MoveDir = DriveControlEventArgs.eMoveDir.LEFT;
|
|
|
- else
|
|
|
- msg.MoveDir = DriveControlEventArgs.eMoveDir.RIGHT;
|
|
|
+ if ( !result )
|
|
|
+ {
|
|
|
+ this.messageController.ShowNotificationView( "Pos Not Selected" );
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- this.PublishEvent(msg);
|
|
|
- }
|
|
|
-
|
|
|
- private void ExecutePositionSaveCommand()
|
|
|
- {
|
|
|
- this.messageController.ShowConfirmationPopupView("Save To Data ?", r =>
|
|
|
- {
|
|
|
- if (r.Result == ButtonResult.OK)
|
|
|
- {
|
|
|
- //TODO:[20/03/18 ys-hwang] DB Table Update
|
|
|
- }
|
|
|
- });
|
|
|
+ var ll = this.RouteList.Where( x => x.IsSelected ).FirstOrDefault();
|
|
|
+ }
|
|
|
+ } );
|
|
|
}
|
|
|
|
|
|
private void ExecutePositionDeleteCommand()
|
|
|
{
|
|
|
- this.messageController.ShowConfirmationPopupView( "Select To Delete ?" , r =>
|
|
|
- {
|
|
|
- if ( r.Result == ButtonResult.OK )
|
|
|
- {
|
|
|
- var deleteList = new List<Route>();
|
|
|
+ this.messageController.ShowConfirmationPopupView( "Select To Delete ?", r =>
|
|
|
+ {
|
|
|
+ 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 ); } );
|
|
|
- }
|
|
|
- } );
|
|
|
+ foreach ( var item in this.RouteList )
|
|
|
+ {
|
|
|
+ if ( item.IsSelected )
|
|
|
+ deleteList.Add( item );
|
|
|
+ }
|
|
|
+ deleteList.ForEach( x => { this.RouteList.Remove( x ); } );
|
|
|
+ }
|
|
|
+ } );
|
|
|
}
|
|
|
|
|
|
private void ExecutePositionAddCommand()
|
|
|
{
|
|
|
- this.messageController.ShowConfirmationPopupView( "Position Add ?" , r =>
|
|
|
- {
|
|
|
- if ( r.Result == ButtonResult.OK )
|
|
|
- {
|
|
|
- this.RouteList.Add( new Route() );
|
|
|
+ this.messageController.ShowConfirmationPopupView( "Position Add ?", r =>
|
|
|
+ {
|
|
|
+ if ( r.Result == ButtonResult.OK )
|
|
|
+ {
|
|
|
+ this.RouteList.Add( new Route() );
|
|
|
|
|
|
- this.messageController.ShowNotificationView( "Create Success" );
|
|
|
- }
|
|
|
- } );
|
|
|
+ this.messageController.ShowNotificationView( "Create Success" );
|
|
|
+ }
|
|
|
+ } );
|
|
|
}
|
|
|
|
|
|
- private void ExecuteKeyInCommadn(object obj)
|
|
|
+ private void ExecuteKeyInCommadn( object obj )
|
|
|
{
|
|
|
var numPad = new CalcuratorView();
|
|
|
- var result = numPad.ShowDialog(this.DriveTargetPos );
|
|
|
+ var result = numPad.ShowDialog( this.DriveTargetPos );
|
|
|
this.DriveTargetPos = result;
|
|
|
}
|
|
|
|
|
|
private void ExecuteOriginCommand()
|
|
|
{
|
|
|
- this.messageController.ShowConfirmationPopupView( "Origin ?" , r =>
|
|
|
- {
|
|
|
- if ( r.Result == ButtonResult.OK )
|
|
|
- {
|
|
|
- //TODO: How to use
|
|
|
- }
|
|
|
- } );
|
|
|
+ this.messageController.ShowConfirmationPopupView( "Origin ?", r =>
|
|
|
+ {
|
|
|
+ if ( r.Result == ButtonResult.OK )
|
|
|
+ {
|
|
|
+ }
|
|
|
+ } );
|
|
|
}
|
|
|
|
|
|
private void ExecuteFaultResetCommand()
|
|
|
{
|
|
|
var msg = new DriveControlEventArgs
|
|
|
{
|
|
|
- EventDir = DriveControlEventArgs.eEventDir.ToBack ,
|
|
|
- ControlKind = DriveControlEventArgs.eControlKind.FaultReset ,
|
|
|
+ EventDir = DriveControlEventArgs.eEventDir.ToBack,
|
|
|
+ ControlKind = DriveControlEventArgs.eControlKind.FaultReset,
|
|
|
};
|
|
|
|
|
|
this.PublishEvent( msg );
|
|
|
@@ -455,8 +481,8 @@ namespace OHV.Module.Interactivity.PopUp
|
|
|
{
|
|
|
var msg = new DriveControlEventArgs
|
|
|
{
|
|
|
- EventDir = DriveControlEventArgs.eEventDir.ToBack ,
|
|
|
- ControlKind = DriveControlEventArgs.eControlKind.DriveOFF ,
|
|
|
+ EventDir = DriveControlEventArgs.eEventDir.ToBack,
|
|
|
+ ControlKind = DriveControlEventArgs.eControlKind.DriveOFF,
|
|
|
};
|
|
|
|
|
|
this.PublishEvent( msg );
|
|
|
@@ -466,8 +492,8 @@ namespace OHV.Module.Interactivity.PopUp
|
|
|
{
|
|
|
var msg = new DriveControlEventArgs
|
|
|
{
|
|
|
- EventDir = DriveControlEventArgs.eEventDir.ToBack ,
|
|
|
- ControlKind = DriveControlEventArgs.eControlKind.DriveON ,
|
|
|
+ EventDir = DriveControlEventArgs.eEventDir.ToBack,
|
|
|
+ ControlKind = DriveControlEventArgs.eControlKind.DriveON,
|
|
|
};
|
|
|
|
|
|
this.PublishEvent( msg );
|
|
|
@@ -475,34 +501,43 @@ namespace OHV.Module.Interactivity.PopUp
|
|
|
|
|
|
private void ExecuteCurrentToTargetCommand()
|
|
|
{
|
|
|
- this.messageController.ShowConfirmationPopupView( "Current To Target ?" , r =>
|
|
|
- {
|
|
|
- if ( r.Result == ButtonResult.OK )
|
|
|
- {
|
|
|
- this.DriveTargetPos = this.CurrentDrive;
|
|
|
- }
|
|
|
- } );
|
|
|
+ this.messageController.ShowConfirmationPopupView( "Current To Target ?", r =>
|
|
|
+ {
|
|
|
+ if ( r.Result == ButtonResult.OK )
|
|
|
+ {
|
|
|
+ this.DriveTargetPos = this.CurrentPosition;
|
|
|
+ }
|
|
|
+ } );
|
|
|
}
|
|
|
|
|
|
private void ExecuteMoveToCommand()
|
|
|
{
|
|
|
- this.messageController.ShowConfirmationPopupView( "Move To Pos ?" , r =>
|
|
|
- {
|
|
|
- if ( r.Result == ButtonResult.OK )
|
|
|
- {
|
|
|
- var msg = new DriveControlEventArgs
|
|
|
- {
|
|
|
- EventDir = DriveControlEventArgs.eEventDir.ToBack ,
|
|
|
- ControlKind = DriveControlEventArgs.eControlKind.MOVE ,
|
|
|
- //PositionTag =
|
|
|
- };
|
|
|
+ this.messageController.ShowConfirmationPopupView( "Move To Selected Position ?", r =>
|
|
|
+ {
|
|
|
+ if ( r.Result == ButtonResult.OK )
|
|
|
+ {
|
|
|
+ var result = this.RouteList.Any( x => x.IsSelected != false );
|
|
|
+ if ( !result )
|
|
|
+ {
|
|
|
+ this.messageController.ShowNotificationView( "Pos Not Selected" );
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- this.PublishEvent( msg );
|
|
|
- }
|
|
|
- } );
|
|
|
+ var ll = this.RouteList.Where( x => x.IsSelected ).FirstOrDefault();
|
|
|
+
|
|
|
+ var msg = new DriveControlEventArgs
|
|
|
+ {
|
|
|
+ EventDir = DriveControlEventArgs.eEventDir.ToBack,
|
|
|
+ ControlKind = DriveControlEventArgs.eControlKind.MOVE,
|
|
|
+ TargetRouteID = ll.Id,
|
|
|
+ };
|
|
|
+
|
|
|
+ this.PublishEvent( msg );
|
|
|
+ }
|
|
|
+ } );
|
|
|
}
|
|
|
|
|
|
- private void ExecuteSelectPosCommand(object obj)
|
|
|
+ private void ExecuteSelectPosCommand( object obj )
|
|
|
{
|
|
|
this.SelectedPosition = obj.ToString();
|
|
|
}
|
|
|
@@ -517,37 +552,48 @@ 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>().Publish( new DriveControlEventArgs { EventDir = DriveControlEventArgs.eEventDir.ToBack, ControlKind = DriveControlEventArgs.eControlKind.ReqStopCurrentPos } );
|
|
|
this.eventAggregator.GetEvent<DriveControlPubSubEvent>().Unsubscribe( DriveControlCallBack );
|
|
|
+ this.eventAggregator.GetEvent<GUIMessagePubSubEvent>().Unsubscribe( UICallBackCommunication );
|
|
|
}
|
|
|
|
|
|
- public void OnDialogOpened(IDialogParameters parameters)
|
|
|
+ public async void OnDialogOpened( IDialogParameters parameters )
|
|
|
{
|
|
|
- var msg = new DriveControlEventArgs
|
|
|
+ Task task = Task.Run( () =>
|
|
|
{
|
|
|
- EventDir = DriveControlEventArgs.eEventDir.ToBack,
|
|
|
- ControlKind = DriveControlEventArgs.eControlKind.SteeringState,
|
|
|
- };
|
|
|
- this.PublishEvent(msg);
|
|
|
+ var msg = new DriveControlEventArgs
|
|
|
+ {
|
|
|
+ EventDir = DriveControlEventArgs.eEventDir.ToBack,
|
|
|
+ ControlKind = DriveControlEventArgs.eControlKind.SteeringState,
|
|
|
+ };
|
|
|
+ this.PublishEvent( msg );
|
|
|
+
|
|
|
+ this.eventAggregator.GetEvent<DriveControlPubSubEvent>().Publish( new DriveControlEventArgs { EventDir = DriveControlEventArgs.eEventDir.ToBack, ControlKind = DriveControlEventArgs.eControlKind.VehicleState } );
|
|
|
+
|
|
|
+ var vcsMsg = new VCSMessageEventArgs() { Kind = VCSMessageEventArgs.eVCSMessageKind.ReqRouteManager };
|
|
|
+ this.eventAggregator.GetEvent<VCSMessagePubSubEvent>().Publish( vcsMsg );
|
|
|
+
|
|
|
+ this.RouteList = new ObservableCollection<Route>( sql.RouteDal.All );
|
|
|
+ } );
|
|
|
|
|
|
- this.eventAggregator.GetEvent<DriveControlPubSubEvent>().Publish( new DriveControlEventArgs { EventDir = DriveControlEventArgs.eEventDir.ToBack , ControlKind = DriveControlEventArgs.eControlKind.ReqCurrentPos } );
|
|
|
+ await task;
|
|
|
}
|
|
|
|
|
|
- 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 ) );
|
|
|
}
|
|
|
|
|
|
- public virtual void RaiseRequestClose(IDialogResult dialogResult)
|
|
|
+ public virtual void RaiseRequestClose( IDialogResult dialogResult )
|
|
|
{
|
|
|
- RequestClose?.Invoke(dialogResult);
|
|
|
+ RequestClose?.Invoke( dialogResult );
|
|
|
}
|
|
|
#endregion
|
|
|
}
|