|
|
@@ -20,7 +20,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 = "LockServoView";
|
|
|
public string Title
|
|
|
@@ -28,7 +28,7 @@ namespace OHV.Module.Interactivity.PopUp
|
|
|
get { return this._title; }
|
|
|
set
|
|
|
{
|
|
|
- this.SetProperty(ref this._title, value);
|
|
|
+ this.SetProperty( ref this._title , value );
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -36,7 +36,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;
|
|
|
@@ -45,7 +45,7 @@ namespace OHV.Module.Interactivity.PopUp
|
|
|
get => this._selectedPosition;
|
|
|
set
|
|
|
{
|
|
|
- this.SetProperty(ref this._selectedPosition, value);
|
|
|
+ this.SetProperty( ref this._selectedPosition , value );
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -54,28 +54,28 @@ 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 ); }
|
|
|
}
|
|
|
|
|
|
Brush _leftAxisBrush = Brushes.Gray;
|
|
|
public Brush LeftAxisBrush
|
|
|
{
|
|
|
get { return this._leftAxisBrush; }
|
|
|
- set { SetProperty(ref this._leftAxisBrush, value); }
|
|
|
+ set { SetProperty( ref this._leftAxisBrush , value ); }
|
|
|
}
|
|
|
|
|
|
private Brush posLockBrush = Brushes.Gray;
|
|
|
@@ -83,7 +83,7 @@ namespace OHV.Module.Interactivity.PopUp
|
|
|
public Brush PosLockBrush
|
|
|
{
|
|
|
get { return posLockBrush; }
|
|
|
- set { SetProperty(ref this.posLockBrush, value); }
|
|
|
+ set { SetProperty( ref this.posLockBrush , value ); }
|
|
|
}
|
|
|
|
|
|
private bool isLeftServoOn;
|
|
|
@@ -91,7 +91,7 @@ namespace OHV.Module.Interactivity.PopUp
|
|
|
public bool IsLeftServoOn
|
|
|
{
|
|
|
get { return isLeftServoOn; }
|
|
|
- set { SetProperty(ref isLeftServoOn, value); }
|
|
|
+ set { SetProperty( ref isLeftServoOn , value ); }
|
|
|
}
|
|
|
|
|
|
private bool isLeftServoOriginReturn;
|
|
|
@@ -99,7 +99,7 @@ namespace OHV.Module.Interactivity.PopUp
|
|
|
public bool IsLeftServoOriginReturn
|
|
|
{
|
|
|
get { return isLeftServoOriginReturn; }
|
|
|
- set { SetProperty(ref isLeftServoOriginReturn, value); }
|
|
|
+ set { SetProperty( ref isLeftServoOriginReturn , value ); }
|
|
|
}
|
|
|
|
|
|
private bool isLeftServoFalut;
|
|
|
@@ -107,7 +107,7 @@ namespace OHV.Module.Interactivity.PopUp
|
|
|
public bool IsLeftServoFault
|
|
|
{
|
|
|
get { return isLeftServoFalut; }
|
|
|
- set { SetProperty(ref isLeftServoFalut, value); }
|
|
|
+ set { SetProperty( ref isLeftServoFalut , value ); }
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
@@ -116,28 +116,28 @@ 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 ); }
|
|
|
}
|
|
|
|
|
|
Brush _rightAxisBrush = Brushes.Gray;
|
|
|
public Brush RightAxisBrush
|
|
|
{
|
|
|
get { return this._rightAxisBrush; }
|
|
|
- set { SetProperty(ref this._rightAxisBrush, value); }
|
|
|
+ set { SetProperty( ref this._rightAxisBrush , value ); }
|
|
|
}
|
|
|
|
|
|
private Brush posUnlockBursh = Brushes.Gray;
|
|
|
@@ -145,14 +145,14 @@ namespace OHV.Module.Interactivity.PopUp
|
|
|
public Brush PosUnlockBrush
|
|
|
{
|
|
|
get { return posUnlockBursh; }
|
|
|
- set { SetProperty(ref this.posUnlockBursh, value); }
|
|
|
+ set { SetProperty( ref this.posUnlockBursh , value ); }
|
|
|
}
|
|
|
|
|
|
private bool isRightServoOn;
|
|
|
public bool IsRightServoOn
|
|
|
{
|
|
|
get { return isRightServoOn; }
|
|
|
- set { SetProperty(ref isRightServoOn, value); }
|
|
|
+ set { SetProperty( ref isRightServoOn , value ); }
|
|
|
}
|
|
|
|
|
|
private bool isRightServoOriginReturn;
|
|
|
@@ -160,7 +160,7 @@ namespace OHV.Module.Interactivity.PopUp
|
|
|
public bool IsRightServoOriginReturn
|
|
|
{
|
|
|
get { return isRightServoOriginReturn; }
|
|
|
- set { SetProperty(ref isRightServoOriginReturn, value); }
|
|
|
+ set { SetProperty( ref isRightServoOriginReturn , value ); }
|
|
|
}
|
|
|
|
|
|
private bool isRightServoFalut;
|
|
|
@@ -168,7 +168,7 @@ namespace OHV.Module.Interactivity.PopUp
|
|
|
public bool IsRightServoFault
|
|
|
{
|
|
|
get { return isRightServoFalut; }
|
|
|
- set { SetProperty(ref isRightServoFalut, value); }
|
|
|
+ set { SetProperty( ref isRightServoFalut , value ); }
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
@@ -191,25 +191,28 @@ namespace OHV.Module.Interactivity.PopUp
|
|
|
MessageController messageController;
|
|
|
SqliteManager sql;
|
|
|
|
|
|
- public LockServoViewModel(IEventAggregator ea, MessageController _messageController, SqliteManager _sql)
|
|
|
+ public LockServoViewModel( IEventAggregator ea , MessageController _messageController , SqliteManager _sql )
|
|
|
{
|
|
|
- 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>(ExecuteKeyInCommand);
|
|
|
+ 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>( ExecuteKeyInCommand );
|
|
|
|
|
|
- this.ServoOnCommand = new DelegateCommand<object>(ExecuteServoOnCommand);
|
|
|
- this.ServoOffCommand = new DelegateCommand<object>(ExecuteServoOffCommand);
|
|
|
- this.FaultResetCommand = new DelegateCommand<object>(ExecuteFaultResetCommand);
|
|
|
- this.OriginCommand = new DelegateCommand<object>(ExecuteOriginCommand);
|
|
|
+ this.ServoOnCommand = new DelegateCommand<object>( ExecuteServoOnCommand );
|
|
|
+ this.ServoOffCommand = new DelegateCommand<object>( ExecuteServoOffCommand );
|
|
|
+ this.FaultResetCommand = new DelegateCommand<object>( ExecuteFaultResetCommand );
|
|
|
+ this.OriginCommand = new DelegateCommand<object>( ExecuteOriginCommand );
|
|
|
|
|
|
- this.SelectedPosDataSave = new DelegateCommand<object>(ExecuteSelectedPosDataSave);
|
|
|
- this.JogCommand = new DelegateCommand<object>(ExecuteJogCommand);
|
|
|
+ this.SelectedPosDataSave = new DelegateCommand<object>( ExecuteSelectedPosDataSave );
|
|
|
+ this.JogCommand = new DelegateCommand<object>( ExecuteJogCommand );
|
|
|
|
|
|
this.eventAggregator = ea;
|
|
|
- this.eventAggregator.GetEvent<AxisControlPubSubEvent>().Unsubscribe(UICallbackCommunication);
|
|
|
- this.eventAggregator.GetEvent<AxisControlPubSubEvent>().Subscribe(UICallbackCommunication, ThreadOption.UIThread);
|
|
|
+ this.eventAggregator.GetEvent<AxisControlPubSubEvent>().Unsubscribe( AxisUICallbackCommunication );
|
|
|
+ this.eventAggregator.GetEvent<AxisControlPubSubEvent>().Subscribe( AxisUICallbackCommunication , ThreadOption.UIThread );
|
|
|
+
|
|
|
+ this.eventAggregator.GetEvent<GUIMessagePubSubEvent>().Unsubscribe( UICallbackCommunication );
|
|
|
+ this.eventAggregator.GetEvent<GUIMessagePubSubEvent>().Subscribe( UICallbackCommunication , ThreadOption.UIThread );
|
|
|
|
|
|
this.messageController = _messageController;
|
|
|
|
|
|
@@ -224,86 +227,97 @@ namespace OHV.Module.Interactivity.PopUp
|
|
|
this.PosLockBrush = Brushes.Orange;
|
|
|
}
|
|
|
|
|
|
- private void ExecuteSelectedPosDataSave(object obj)
|
|
|
+ private void UICallbackCommunication( GUIMessageEventArgs obj )
|
|
|
{
|
|
|
- List<Common.Model.AxisPositionData> dataList = null;
|
|
|
+ if ( obj.Kind == GUIMessageEventArgs.eGUIMessageKind.ModelPropertyChange )
|
|
|
+ {
|
|
|
+ if ( obj.MessageKey.Equals( MessageKey.Vehicle ) )
|
|
|
+ {
|
|
|
|
|
|
- this.messageController.ShowConfirmationPopupView("Position Data Save ?", r =>
|
|
|
- {
|
|
|
- if (r.Result == ButtonResult.OK)
|
|
|
- {
|
|
|
- if (this.SelectAxis == ConstString.AXIS_CARRIER_LOCK_LEFT)
|
|
|
- {
|
|
|
- switch (this.SelectedPosition)
|
|
|
- {
|
|
|
- case ConstString.TEACH_POSITION_LOCK:
|
|
|
- dataList = sql.AxisPositionDataDAL.GetKFromPostion(ConstString.TEACH_POSITION_LOCK);
|
|
|
- break;
|
|
|
- case ConstString.TEACH_POSITION_UNLOCK:
|
|
|
- dataList = sql.AxisPositionDataDAL.GetKFromPostion(ConstString.TEACH_POSITION_UNLOCK);
|
|
|
- break;
|
|
|
- }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- var sqlAxisLeft = dataList.Where(x => x.AxisName.Equals(ConstString.AXIS_CARRIER_LOCK_LEFT)).Single();
|
|
|
- sqlAxisLeft.Value = this.CurrentLockLeft;
|
|
|
- sql.AxisPositionDataDAL.Update(sqlAxisLeft);
|
|
|
- }
|
|
|
- else if (this.SelectAxis == ConstString.AXIS_CARRIER_LOCK_RIGHT)
|
|
|
- {
|
|
|
- switch (this.SelectedPosition)
|
|
|
- {
|
|
|
- case ConstString.TEACH_POSITION_LOCK:
|
|
|
- dataList = sql.AxisPositionDataDAL.GetKFromPostion(ConstString.TEACH_POSITION_LOCK);
|
|
|
- break;
|
|
|
- case ConstString.TEACH_POSITION_UNLOCK:
|
|
|
- dataList = sql.AxisPositionDataDAL.GetKFromPostion(ConstString.TEACH_POSITION_UNLOCK);
|
|
|
- break;
|
|
|
- }
|
|
|
- var sqlAxisRight = dataList.Where(x => x.AxisName.Equals(ConstString.AXIS_CARRIER_LOCK_RIGHT)).Single();
|
|
|
- sqlAxisRight.Value = this.CurrentLockLeft;
|
|
|
- sql.AxisPositionDataDAL.Update(sqlAxisRight);
|
|
|
- }
|
|
|
- else
|
|
|
- { }
|
|
|
- }
|
|
|
- });
|
|
|
+ private void ExecuteSelectedPosDataSave( object obj )
|
|
|
+ {
|
|
|
+ List<Common.Model.AxisPositionData> dataList = null;
|
|
|
+
|
|
|
+ this.messageController.ShowConfirmationPopupView( "Position Data Save ?" , r =>
|
|
|
+ {
|
|
|
+ if ( r.Result == ButtonResult.OK )
|
|
|
+ {
|
|
|
+ if ( this.SelectAxis == ConstString.AXIS_CARRIER_LOCK_LEFT )
|
|
|
+ {
|
|
|
+ switch ( this.SelectedPosition )
|
|
|
+ {
|
|
|
+ case ConstString.TEACH_POSITION_LOCK:
|
|
|
+ dataList = sql.AxisPositionDataDAL.GetKFromPostion( ConstString.TEACH_POSITION_LOCK );
|
|
|
+ break;
|
|
|
+ case ConstString.TEACH_POSITION_UNLOCK:
|
|
|
+ dataList = sql.AxisPositionDataDAL.GetKFromPostion( ConstString.TEACH_POSITION_UNLOCK );
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ var sqlAxisLeft = dataList.Where( x => x.AxisName.Equals( ConstString.AXIS_CARRIER_LOCK_LEFT ) ).Single();
|
|
|
+ sqlAxisLeft.Value = this.CurrentLockLeft;
|
|
|
+ sql.AxisPositionDataDAL.Update( sqlAxisLeft );
|
|
|
+ }
|
|
|
+ else if ( this.SelectAxis == ConstString.AXIS_CARRIER_LOCK_RIGHT )
|
|
|
+ {
|
|
|
+ switch ( this.SelectedPosition )
|
|
|
+ {
|
|
|
+ case ConstString.TEACH_POSITION_LOCK:
|
|
|
+ dataList = sql.AxisPositionDataDAL.GetKFromPostion( ConstString.TEACH_POSITION_LOCK );
|
|
|
+ break;
|
|
|
+ case ConstString.TEACH_POSITION_UNLOCK:
|
|
|
+ dataList = sql.AxisPositionDataDAL.GetKFromPostion( ConstString.TEACH_POSITION_UNLOCK );
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ var sqlAxisRight = dataList.Where( x => x.AxisName.Equals( ConstString.AXIS_CARRIER_LOCK_RIGHT ) ).Single();
|
|
|
+ sqlAxisRight.Value = this.CurrentLockLeft;
|
|
|
+ sql.AxisPositionDataDAL.Update( sqlAxisRight );
|
|
|
+ }
|
|
|
+ else
|
|
|
+ { }
|
|
|
+ }
|
|
|
+ } );
|
|
|
}
|
|
|
|
|
|
- private void ExecuteJogCommand(object obj)
|
|
|
+ private void ExecuteJogCommand( object obj )
|
|
|
{
|
|
|
var msg = new AxisControlEventArgs
|
|
|
{
|
|
|
- Dir = AxisControlEventArgs.eEventDir.ToBack,
|
|
|
- Kind = AxisControlEventArgs.eAxisControlKind.Jog,
|
|
|
- AxisName = this.SelectAxis,
|
|
|
+ Dir = AxisControlEventArgs.eEventDir.ToBack ,
|
|
|
+ Kind = AxisControlEventArgs.eAxisControlKind.Jog ,
|
|
|
+ AxisName = this.SelectAxis ,
|
|
|
};
|
|
|
|
|
|
- if (obj.ToString().Equals("+"))
|
|
|
+ if ( obj.ToString().Equals( "+" ) )
|
|
|
msg.JogDir = AxisControlEventArgs.eJogMoveDir.Positive;
|
|
|
else
|
|
|
msg.JogDir = AxisControlEventArgs.eJogMoveDir.Negative;
|
|
|
|
|
|
- this.PublishEvent(msg);
|
|
|
+ this.PublishEvent( msg );
|
|
|
}
|
|
|
|
|
|
- void PublishEvent(AxisControlEventArgs args)
|
|
|
+ void PublishEvent( AxisControlEventArgs args )
|
|
|
{
|
|
|
args.Dir = AxisControlEventArgs.eEventDir.ToBack;
|
|
|
- this.eventAggregator.GetEvent<AxisControlPubSubEvent>().Publish(args);
|
|
|
+ this.eventAggregator.GetEvent<AxisControlPubSubEvent>().Publish( args );
|
|
|
}
|
|
|
|
|
|
- void UICallbackCommunication(AxisControlEventArgs args)
|
|
|
+ void AxisUICallbackCommunication( AxisControlEventArgs args )
|
|
|
{
|
|
|
- if (args.Dir == AxisControlEventArgs.eEventDir.ToFront)
|
|
|
+ if ( args.Dir == AxisControlEventArgs.eEventDir.ToFront )
|
|
|
{
|
|
|
- switch (args.Kind)
|
|
|
+ switch ( args.Kind )
|
|
|
{
|
|
|
case AxisControlEventArgs.eAxisControlKind.Stop:
|
|
|
break;
|
|
|
case AxisControlEventArgs.eAxisControlKind.EStop:
|
|
|
break;
|
|
|
case AxisControlEventArgs.eAxisControlKind.Move:
|
|
|
- RspMove(args);
|
|
|
+ RspMove( args );
|
|
|
break;
|
|
|
case AxisControlEventArgs.eAxisControlKind.Jog:
|
|
|
break;
|
|
|
@@ -314,15 +328,25 @@ namespace OHV.Module.Interactivity.PopUp
|
|
|
case AxisControlEventArgs.eAxisControlKind.NONE:
|
|
|
break;
|
|
|
case AxisControlEventArgs.eAxisControlKind.OriginReturn:
|
|
|
+ //TODO:[20/03/20 sy-hwang] Origin 시작 시 UI Lock 여부 ?
|
|
|
break;
|
|
|
case AxisControlEventArgs.eAxisControlKind.ReqCurrentPosition:
|
|
|
break;
|
|
|
case AxisControlEventArgs.eAxisControlKind.ReqStopCurrentPosition:
|
|
|
break;
|
|
|
case AxisControlEventArgs.eAxisControlKind.FaultReset:
|
|
|
+ {
|
|
|
+ var msg = string.Empty;
|
|
|
+ if ( args.Result.IsSuccess )
|
|
|
+ msg = $" {this.SelectAxis} Reset Success ";
|
|
|
+ else
|
|
|
+ msg = $" {this.SelectAxis} Reset Failed ";
|
|
|
+
|
|
|
+ this.messageController.ShowNotificationView( msg );
|
|
|
+ }
|
|
|
break;
|
|
|
case AxisControlEventArgs.eAxisControlKind.AxisState:
|
|
|
- AxisState(args);
|
|
|
+ AxisState( args );
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
@@ -330,10 +354,10 @@ namespace OHV.Module.Interactivity.PopUp
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void AxisState(AxisControlEventArgs args)
|
|
|
+ private void AxisState( AxisControlEventArgs args )
|
|
|
{
|
|
|
- var left = args.Args["Left"] as AxisState;
|
|
|
- var right = args.Args["Right"] as AxisState;
|
|
|
+ var left = args.Args[ "Left" ] as AxisState;
|
|
|
+ var right = args.Args[ "Right" ] as AxisState;
|
|
|
|
|
|
this.IsLeftServoOn = left.IsServoOn;
|
|
|
this.IsLeftServoOriginReturn = left.IsOriginReturn;
|
|
|
@@ -346,13 +370,13 @@ namespace OHV.Module.Interactivity.PopUp
|
|
|
this.CurrentLockRight = right.CurrentPosition;
|
|
|
}
|
|
|
|
|
|
- private void RspMove(AxisControlEventArgs args)
|
|
|
+ private void RspMove( AxisControlEventArgs args )
|
|
|
{
|
|
|
string msg = string.Empty;
|
|
|
|
|
|
- if (args.Result.IsSuccess)
|
|
|
+ if ( args.Result.IsSuccess )
|
|
|
{
|
|
|
- if (args.PosDir == AxisControlEventArgs.ePosDir.Lock)
|
|
|
+ if ( args.PosDir == AxisControlEventArgs.ePosDir.Lock )
|
|
|
msg = "Clamp Lock Success";
|
|
|
else
|
|
|
msg = "Clamp Unlock Success";
|
|
|
@@ -360,120 +384,120 @@ namespace OHV.Module.Interactivity.PopUp
|
|
|
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);
|
|
|
+ this.messageController.ShowNotificationView( msg );
|
|
|
}
|
|
|
|
|
|
- private void ExecuteOriginCommand(object obj)
|
|
|
+ private void ExecuteOriginCommand( object obj )
|
|
|
{
|
|
|
var msg = new AxisControlEventArgs
|
|
|
{
|
|
|
- Dir = AxisControlEventArgs.eEventDir.ToBack,
|
|
|
- Kind = AxisControlEventArgs.eAxisControlKind.OriginReturn,
|
|
|
- AxisName = this.SelectAxis,
|
|
|
+ Dir = AxisControlEventArgs.eEventDir.ToBack ,
|
|
|
+ Kind = AxisControlEventArgs.eAxisControlKind.OriginReturn ,
|
|
|
+ AxisName = this.SelectAxis ,
|
|
|
};
|
|
|
|
|
|
- this.PublishEvent(msg);
|
|
|
+ this.PublishEvent( msg );
|
|
|
}
|
|
|
|
|
|
- private void ExecuteFaultResetCommand(object obj)
|
|
|
+ private void ExecuteFaultResetCommand( object obj )
|
|
|
{
|
|
|
var msg = new AxisControlEventArgs
|
|
|
{
|
|
|
- Dir = AxisControlEventArgs.eEventDir.ToBack,
|
|
|
- Kind = AxisControlEventArgs.eAxisControlKind.FaultReset,
|
|
|
- AxisName = this.SelectAxis,
|
|
|
+ Dir = AxisControlEventArgs.eEventDir.ToBack ,
|
|
|
+ Kind = AxisControlEventArgs.eAxisControlKind.FaultReset ,
|
|
|
+ AxisName = this.SelectAxis ,
|
|
|
};
|
|
|
|
|
|
- this.PublishEvent(msg);
|
|
|
+ this.PublishEvent( msg );
|
|
|
}
|
|
|
|
|
|
- private void ExecuteServoOffCommand(object obj)
|
|
|
+ private void ExecuteServoOffCommand( object obj )
|
|
|
{
|
|
|
var msg = new AxisControlEventArgs
|
|
|
{
|
|
|
- Dir = AxisControlEventArgs.eEventDir.ToBack,
|
|
|
- Kind = AxisControlEventArgs.eAxisControlKind.ServoOff,
|
|
|
- AxisName = this.SelectAxis,
|
|
|
+ Dir = AxisControlEventArgs.eEventDir.ToBack ,
|
|
|
+ Kind = AxisControlEventArgs.eAxisControlKind.ServoOff ,
|
|
|
+ AxisName = this.SelectAxis ,
|
|
|
};
|
|
|
|
|
|
- this.PublishEvent(msg);
|
|
|
+ this.PublishEvent( msg );
|
|
|
}
|
|
|
|
|
|
- private void ExecuteServoOnCommand(object obj)
|
|
|
+ private void ExecuteServoOnCommand( object obj )
|
|
|
{
|
|
|
var msg = new AxisControlEventArgs
|
|
|
{
|
|
|
- Dir = AxisControlEventArgs.eEventDir.ToBack,
|
|
|
- Kind = AxisControlEventArgs.eAxisControlKind.ServoOn,
|
|
|
- AxisName = this.SelectAxis,
|
|
|
+ Dir = AxisControlEventArgs.eEventDir.ToBack ,
|
|
|
+ Kind = AxisControlEventArgs.eAxisControlKind.ServoOn ,
|
|
|
+ AxisName = this.SelectAxis ,
|
|
|
};
|
|
|
|
|
|
- this.PublishEvent(msg);
|
|
|
+ this.PublishEvent( msg );
|
|
|
}
|
|
|
|
|
|
- private void ExecuteKeyInCommand(object obj)
|
|
|
+ private void ExecuteKeyInCommand( 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.messageController.ShowConfirmationPopupView("Current Position To Target Position ?", r =>
|
|
|
- {
|
|
|
- if (r.Result == ButtonResult.OK)
|
|
|
- {
|
|
|
- switch(this.SelectAxis)
|
|
|
- {
|
|
|
- case ConstString.AXIS_CARRIER_LOCK_LEFT:
|
|
|
- this.TargetPosLockLeft = this.CurrentLockLeft;
|
|
|
- break;
|
|
|
- case ConstString.AXIS_CARRIER_LOCK_RIGHT:
|
|
|
- this.TargetPosLockRight = this.CurrentLockRight;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
+ this.messageController.ShowConfirmationPopupView( "Current Position To Target Position ?" , r =>
|
|
|
+ {
|
|
|
+ if ( r.Result == ButtonResult.OK )
|
|
|
+ {
|
|
|
+ switch ( this.SelectAxis )
|
|
|
+ {
|
|
|
+ case ConstString.AXIS_CARRIER_LOCK_LEFT:
|
|
|
+ this.TargetPosLockLeft = this.CurrentLockLeft;
|
|
|
+ break;
|
|
|
+ case ConstString.AXIS_CARRIER_LOCK_RIGHT:
|
|
|
+ this.TargetPosLockRight = this.CurrentLockRight;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } );
|
|
|
}
|
|
|
|
|
|
- private void ExecuteMoveToCommand()
|
|
|
+ private void ExecuteMoveToCommand( )
|
|
|
{
|
|
|
- this.messageController.ShowConfirmationPopupView($"Clamp Move To {this.SelectedPosition}", r =>
|
|
|
- {
|
|
|
- if (r.Result == ButtonResult.OK)
|
|
|
- {
|
|
|
- var msg = new AxisControlEventArgs();
|
|
|
- msg.Kind = AxisControlEventArgs.eAxisControlKind.Move;
|
|
|
+ this.messageController.ShowConfirmationPopupView( $"Clamp Move To {this.SelectedPosition}" , r =>
|
|
|
+ {
|
|
|
+ if ( r.Result == ButtonResult.OK )
|
|
|
+ {
|
|
|
+ var msg = new AxisControlEventArgs();
|
|
|
+ msg.Kind = AxisControlEventArgs.eAxisControlKind.Move;
|
|
|
|
|
|
- if (SelectedPosition.Equals(ConstString.TEACH_POSITION_LOCK))
|
|
|
- msg.PosDir = AxisControlEventArgs.ePosDir.Lock;
|
|
|
- else
|
|
|
- msg.PosDir = AxisControlEventArgs.ePosDir.UnLock;
|
|
|
+ if ( SelectedPosition.Equals( ConstString.TEACH_POSITION_LOCK ) )
|
|
|
+ msg.PosDir = AxisControlEventArgs.ePosDir.Lock;
|
|
|
+ else
|
|
|
+ msg.PosDir = AxisControlEventArgs.ePosDir.UnLock;
|
|
|
|
|
|
- this.PublishEvent(msg);
|
|
|
- }
|
|
|
- });
|
|
|
+ this.PublishEvent( msg );
|
|
|
+ }
|
|
|
+ } );
|
|
|
}
|
|
|
|
|
|
- private void ExecuteSelectPosCommand(object obj)
|
|
|
+ private void ExecuteSelectPosCommand( object obj )
|
|
|
{
|
|
|
this.SelectedPosition = obj.ToString();
|
|
|
|
|
|
- if (obj.Equals(ConstString.TEACH_POSITION_LOCK))
|
|
|
+ if ( obj.Equals( ConstString.TEACH_POSITION_LOCK ) )
|
|
|
{
|
|
|
this.PosLockBrush = Brushes.Orange;
|
|
|
this.PosUnlockBrush = Brushes.Gray;
|
|
|
@@ -485,9 +509,9 @@ namespace OHV.Module.Interactivity.PopUp
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void ExecuteSelectAxisCommand(object obj)
|
|
|
+ private void ExecuteSelectAxisCommand( object obj )
|
|
|
{
|
|
|
- if (obj.ToString().Equals(ConstString.AXIS_CARRIER_LOCK_LEFT))
|
|
|
+ if ( obj.ToString().Equals( ConstString.AXIS_CARRIER_LOCK_LEFT ) )
|
|
|
{
|
|
|
this.LeftAxisBrush = Brushes.Orange;
|
|
|
this.RightAxisBrush = System.Windows.Media.Brushes.Gray;
|
|
|
@@ -502,38 +526,38 @@ namespace OHV.Module.Interactivity.PopUp
|
|
|
}
|
|
|
|
|
|
#region Dialog
|
|
|
- public bool CanCloseDialog()
|
|
|
+ public bool CanCloseDialog( )
|
|
|
{
|
|
|
//throw new NotImplementedException();
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- public void OnDialogClosed()
|
|
|
+ public void OnDialogClosed( )
|
|
|
{
|
|
|
- this.eventAggregator.GetEvent<AxisControlPubSubEvent>().Publish(new AxisControlEventArgs { Dir = AxisControlEventArgs.eEventDir.ToBack, Kind = AxisControlEventArgs.eAxisControlKind.ReqStopCurrentPosition });
|
|
|
- this.eventAggregator.GetEvent<AxisControlPubSubEvent>().Unsubscribe(UICallbackCommunication);
|
|
|
+ this.eventAggregator.GetEvent<AxisControlPubSubEvent>().Publish( new AxisControlEventArgs { Dir = AxisControlEventArgs.eEventDir.ToBack , Kind = AxisControlEventArgs.eAxisControlKind.ReqStopCurrentPosition } );
|
|
|
+ this.eventAggregator.GetEvent<AxisControlPubSubEvent>().Unsubscribe( AxisUICallbackCommunication );
|
|
|
}
|
|
|
|
|
|
- public void OnDialogOpened(IDialogParameters parameters)
|
|
|
+ public void OnDialogOpened( IDialogParameters parameters )
|
|
|
{
|
|
|
- this.eventAggregator.GetEvent<AxisControlPubSubEvent>().Publish(new AxisControlEventArgs { Dir = AxisControlEventArgs.eEventDir.ToBack, Kind = AxisControlEventArgs.eAxisControlKind.ReqCurrentPosition });
|
|
|
+ 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
|
|
|
}
|