|
|
@@ -1,4 +1,5 @@
|
|
|
using OHV.Common.Events;
|
|
|
+using OHV.Common.Model;
|
|
|
using OHV.Common.Shareds;
|
|
|
using OHV.SqliteDAL;
|
|
|
using Prism.Commands;
|
|
|
@@ -7,11 +8,11 @@ using Prism.Mvvm;
|
|
|
using Prism.Services.Dialogs;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
-using System.Drawing;
|
|
|
using System.Linq;
|
|
|
-using System.Text;
|
|
|
using System.Threading.Tasks;
|
|
|
using System.Windows.Input;
|
|
|
+using System.Windows.Media;
|
|
|
+using static OHV.Common.Events.AxisControlEventArgs;
|
|
|
|
|
|
namespace OHV.Module.Interactivity.PopUp
|
|
|
{
|
|
|
@@ -19,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
|
|
|
@@ -27,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);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -35,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;
|
|
|
@@ -44,7 +45,7 @@ namespace OHV.Module.Interactivity.PopUp
|
|
|
get => this._selectedPosition;
|
|
|
set
|
|
|
{
|
|
|
- this.SetProperty( ref this._selectedPosition , value );
|
|
|
+ this.SetProperty(ref this._selectedPosition, value);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -53,21 +54,60 @@ 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); }
|
|
|
+ }
|
|
|
+
|
|
|
+ private Brush posLockBrush = Brushes.Gray;
|
|
|
+
|
|
|
+ public Brush PosLockBrush
|
|
|
+ {
|
|
|
+ get { return posLockBrush; }
|
|
|
+ set { SetProperty(ref this.posLockBrush, value); }
|
|
|
+ }
|
|
|
+
|
|
|
+ private bool isLeftServoOn;
|
|
|
+
|
|
|
+ public bool IsLeftServoOn
|
|
|
+ {
|
|
|
+ get { return isLeftServoOn; }
|
|
|
+ set { SetProperty(ref isLeftServoOn, value); }
|
|
|
+ }
|
|
|
+
|
|
|
+ private bool isLeftServoOriginReturn;
|
|
|
+
|
|
|
+ public bool IsLeftServoOriginReturn
|
|
|
+ {
|
|
|
+ get { return isLeftServoOriginReturn; }
|
|
|
+ set { SetProperty(ref isLeftServoOriginReturn, value); }
|
|
|
+ }
|
|
|
+
|
|
|
+ private bool isLeftServoFalut;
|
|
|
+
|
|
|
+ public bool IsLeftServoFault
|
|
|
+ {
|
|
|
+ get { return isLeftServoFalut; }
|
|
|
+ set { SetProperty(ref isLeftServoFalut, value); }
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
@@ -76,31 +116,63 @@ namespace OHV.Module.Interactivity.PopUp
|
|
|
public double TargetPosLockRight
|
|
|
{
|
|
|
get { return this._targetPosLockRight; }
|
|
|
- set { this.SetProperty( ref this._targetPosLockRight , value ); }
|
|
|
+ set { this.SetProperty(ref this._targetPosLockRight, value); }
|
|
|
}
|
|
|
|
|
|
private double _currentLockRight;
|
|
|
public double CurrentLockRight
|
|
|
{
|
|
|
get { return this._currentLockRight; }
|
|
|
- set { this.SetProperty( ref this._currentLockRight , value ); }
|
|
|
+ set { this.SetProperty(ref this._currentLockRight, value); }
|
|
|
}
|
|
|
|
|
|
private double _differenceLockRight;
|
|
|
public double DifferenceLockRight
|
|
|
{
|
|
|
get { return this._differenceLockRight; }
|
|
|
- set { this.SetProperty( ref this._differenceLockRight , value ); }
|
|
|
+ set { this.SetProperty(ref this._differenceLockRight, value); }
|
|
|
}
|
|
|
- #endregion
|
|
|
|
|
|
- Brush _selectControl = Brushes.Gray;
|
|
|
- public Brush SelectControl
|
|
|
+ Brush _rightAxisBrush = Brushes.Gray;
|
|
|
+ public Brush RightAxisBrush
|
|
|
+ {
|
|
|
+ get { return this._rightAxisBrush; }
|
|
|
+ set { SetProperty(ref this._rightAxisBrush, value); }
|
|
|
+ }
|
|
|
+
|
|
|
+ private Brush posUnlockBursh = Brushes.Gray;
|
|
|
+
|
|
|
+ public Brush PosUnlockBrush
|
|
|
+ {
|
|
|
+ get { return posUnlockBursh; }
|
|
|
+ set { SetProperty(ref this.posUnlockBursh, value); }
|
|
|
+ }
|
|
|
+
|
|
|
+ private bool isRightServoOn;
|
|
|
+ public bool IsRightServoOn
|
|
|
+ {
|
|
|
+ get { return isRightServoOn; }
|
|
|
+ set { SetProperty(ref isRightServoOn, value); }
|
|
|
+ }
|
|
|
+
|
|
|
+ private bool isRightServoOriginReturn;
|
|
|
+
|
|
|
+ public bool IsRightServoOriginReturn
|
|
|
+ {
|
|
|
+ get { return isRightServoOriginReturn; }
|
|
|
+ set { SetProperty(ref isRightServoOriginReturn, value); }
|
|
|
+ }
|
|
|
+
|
|
|
+ private bool isRightServoFalut;
|
|
|
+
|
|
|
+ public bool IsRightServoFault
|
|
|
{
|
|
|
- get { return this._selectControl; }
|
|
|
- set { SetProperty( ref this._selectControl , value ); }
|
|
|
+ get { return isRightServoFalut; }
|
|
|
+ set { SetProperty(ref isRightServoFalut, value); }
|
|
|
}
|
|
|
|
|
|
+ #endregion
|
|
|
+
|
|
|
public ICommand SelectAxisCommand { get; set; }
|
|
|
public ICommand KeyInTargetPosCommand { get; set; }
|
|
|
public ICommand SelectPosCommand { get; set; }
|
|
|
@@ -119,279 +191,342 @@ 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.SelectedPosDataSave = new DelegateCommand<object>( ExecuteSelectedPosDataSave );
|
|
|
+ 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.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(UICallbackCommunication);
|
|
|
+ this.eventAggregator.GetEvent<AxisControlPubSubEvent>().Subscribe(UICallbackCommunication, ThreadOption.UIThread);
|
|
|
|
|
|
this.messageController = _messageController;
|
|
|
|
|
|
this.sql = _sql;
|
|
|
+
|
|
|
+ //초기 선택 축
|
|
|
+ this.SelectAxis = ConstString.AXIS_CARRIER_LOCK_LEFT;
|
|
|
+ this.LeftAxisBrush = Brushes.Orange;
|
|
|
+
|
|
|
+ //초기 Pos 선택
|
|
|
+ this.SelectedPosition = ConstString.TEACH_POSITION_LOCK;
|
|
|
+ this.PosLockBrush = Brushes.Orange;
|
|
|
}
|
|
|
|
|
|
- private void ExecuteSelectedPosDataSave( object obj )
|
|
|
+ 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
|
|
|
- { }
|
|
|
- }
|
|
|
- } );
|
|
|
+ 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)
|
|
|
{
|
|
|
- this.eventAggregator.GetEvent<AxisControlPubSubEvent>().Publish( args );
|
|
|
+ args.Dir = AxisControlEventArgs.eEventDir.ToBack;
|
|
|
+ this.eventAggregator.GetEvent<AxisControlPubSubEvent>().Publish(args);
|
|
|
}
|
|
|
|
|
|
- void UICallbackCommunication( AxisControlEventArgs args )
|
|
|
+ void UICallbackCommunication(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);
|
|
|
break;
|
|
|
case AxisControlEventArgs.eAxisControlKind.Jog:
|
|
|
break;
|
|
|
- case AxisControlEventArgs.eAxisControlKind.CurrentPosition:
|
|
|
- if ( args.AxisName.Equals( ConstString.AXIS_CARRIER_LOCK_LEFT ) )
|
|
|
- this.CurrentLockLeft = args.CurrentPosition;
|
|
|
- else
|
|
|
- this.CurrentLockRight = args.CurrentPosition;
|
|
|
- break;
|
|
|
case AxisControlEventArgs.eAxisControlKind.ServoOn:
|
|
|
break;
|
|
|
case AxisControlEventArgs.eAxisControlKind.ServoOff:
|
|
|
break;
|
|
|
+ case AxisControlEventArgs.eAxisControlKind.NONE:
|
|
|
+ break;
|
|
|
+ case AxisControlEventArgs.eAxisControlKind.OriginReturn:
|
|
|
+ break;
|
|
|
+ case AxisControlEventArgs.eAxisControlKind.ReqCurrentPosition:
|
|
|
+ break;
|
|
|
+ case AxisControlEventArgs.eAxisControlKind.ReqStopCurrentPosition:
|
|
|
+ break;
|
|
|
+ case AxisControlEventArgs.eAxisControlKind.FaultReset:
|
|
|
+ break;
|
|
|
+ case AxisControlEventArgs.eAxisControlKind.AxisState:
|
|
|
+ AxisState(args);
|
|
|
+ break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void ExecuteOriginCommand( object obj )
|
|
|
+ private void AxisState(AxisControlEventArgs args)
|
|
|
{
|
|
|
- var msg = new AxisControlEventArgs
|
|
|
- {
|
|
|
- Dir = AxisControlEventArgs.eEventDir.ToBack ,
|
|
|
- Kind = AxisControlEventArgs.eAxisControlKind.OriginReturn ,
|
|
|
- AxisName = this.SelectAxis ,
|
|
|
- };
|
|
|
+ var left = args.Args["Left"] as AxisState;
|
|
|
+ var right = args.Args["Right"] as AxisState;
|
|
|
+
|
|
|
+ this.IsLeftServoOn = left.IsServoOn;
|
|
|
+ this.IsLeftServoOriginReturn = left.IsOriginReturn;
|
|
|
+ this.IsLeftServoFault = left.IsAmpFault;
|
|
|
+ this.CurrentLockLeft = left.CurrentPosition;
|
|
|
+
|
|
|
+ this.IsRightServoOn = right.IsServoOn;
|
|
|
+ this.IsRightServoOriginReturn = right.IsOriginReturn;
|
|
|
+ this.IsRightServoFault = right.IsAmpFault;
|
|
|
+ this.CurrentLockRight = right.CurrentPosition;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void RspMove(AxisControlEventArgs args)
|
|
|
+ {
|
|
|
+ string msg = string.Empty;
|
|
|
|
|
|
- if ( obj.ToString().Equals( "Left" ) )
|
|
|
- msg.Axis = AxisControlEventArgs.eAxises.LEFT;
|
|
|
+ if (args.Result.IsSuccess)
|
|
|
+ {
|
|
|
+ if (args.PosDir == AxisControlEventArgs.ePosDir.Lock)
|
|
|
+ msg = "Clamp Lock Success";
|
|
|
+ else
|
|
|
+ msg = "Clamp Unlock Success";
|
|
|
+ }
|
|
|
else
|
|
|
- msg.Axis = AxisControlEventArgs.eAxises.RIGHT;
|
|
|
+ {
|
|
|
+ var error = args.Result.Errors.FirstOrDefault();
|
|
|
+ var alarm = error.Metadata["Alarm"] as Alarm;
|
|
|
+ msg = alarm.Name + " " + alarm.Text;
|
|
|
+ }
|
|
|
|
|
|
- this.PublishEvent( msg );
|
|
|
- }
|
|
|
+ this.messageController.ShowNotificationView(msg);
|
|
|
+ }
|
|
|
|
|
|
- private void ExecuteFaultResetCommand( object obj )
|
|
|
+ private void ExecuteOriginCommand(object obj)
|
|
|
{
|
|
|
var msg = new AxisControlEventArgs
|
|
|
{
|
|
|
- Dir = AxisControlEventArgs.eEventDir.ToBack ,
|
|
|
- Kind = AxisControlEventArgs.eAxisControlKind.FaultReset ,
|
|
|
- AxisName = this.SelectAxis ,
|
|
|
+ Dir = AxisControlEventArgs.eEventDir.ToBack,
|
|
|
+ Kind = AxisControlEventArgs.eAxisControlKind.OriginReturn,
|
|
|
+ AxisName = this.SelectAxis,
|
|
|
};
|
|
|
|
|
|
- if ( obj.ToString().Equals( "Left" ) )
|
|
|
- msg.Axis = AxisControlEventArgs.eAxises.LEFT;
|
|
|
- else
|
|
|
- msg.Axis = AxisControlEventArgs.eAxises.RIGHT;
|
|
|
-
|
|
|
- this.PublishEvent( msg );
|
|
|
+ this.PublishEvent(msg);
|
|
|
}
|
|
|
|
|
|
- private void ExecuteServoOffCommand( object obj )
|
|
|
+ private void ExecuteFaultResetCommand(object obj)
|
|
|
{
|
|
|
var msg = new AxisControlEventArgs
|
|
|
{
|
|
|
- Dir = AxisControlEventArgs.eEventDir.ToBack ,
|
|
|
- Kind = AxisControlEventArgs.eAxisControlKind.ServoOff ,
|
|
|
- AxisName = this.SelectAxis ,
|
|
|
+ Dir = AxisControlEventArgs.eEventDir.ToBack,
|
|
|
+ Kind = AxisControlEventArgs.eAxisControlKind.FaultReset,
|
|
|
+ AxisName = this.SelectAxis,
|
|
|
};
|
|
|
|
|
|
- if ( obj.ToString().Equals( "Left" ) )
|
|
|
- msg.Axis = AxisControlEventArgs.eAxises.LEFT;
|
|
|
- else
|
|
|
- msg.Axis = AxisControlEventArgs.eAxises.RIGHT;
|
|
|
-
|
|
|
- this.PublishEvent( msg );
|
|
|
+ this.PublishEvent(msg);
|
|
|
}
|
|
|
|
|
|
- private void ExecuteServoOnCommand( object obj )
|
|
|
+ private void ExecuteServoOffCommand(object obj)
|
|
|
{
|
|
|
var msg = new AxisControlEventArgs
|
|
|
{
|
|
|
- Dir = AxisControlEventArgs.eEventDir.ToBack ,
|
|
|
- Kind = AxisControlEventArgs.eAxisControlKind.ServoOn ,
|
|
|
- AxisName = this.SelectAxis ,
|
|
|
+ Dir = AxisControlEventArgs.eEventDir.ToBack,
|
|
|
+ Kind = AxisControlEventArgs.eAxisControlKind.ServoOff,
|
|
|
+ AxisName = this.SelectAxis,
|
|
|
};
|
|
|
|
|
|
- if ( obj.ToString().Equals( "Left" ) )
|
|
|
- msg.Axis = AxisControlEventArgs.eAxises.LEFT;
|
|
|
- else
|
|
|
- msg.Axis = AxisControlEventArgs.eAxises.RIGHT;
|
|
|
+ this.PublishEvent(msg);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void ExecuteServoOnCommand(object obj)
|
|
|
+ {
|
|
|
+ var msg = new AxisControlEventArgs
|
|
|
+ {
|
|
|
+ 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.TargetPosLockLeft = this.CurrentLockLeft;
|
|
|
- this.TargetPosLockRight = this.CurrentLockRight;
|
|
|
+ this.messageController.ShowConfirmationPopupView("Current Position To Target Position ?", r =>
|
|
|
+ {
|
|
|
+ if (r.Result == ButtonResult.OK)
|
|
|
+ {
|
|
|
+ this.TargetPosLockLeft = this.CurrentLockLeft;
|
|
|
+ this.TargetPosLockRight = this.CurrentLockRight;
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
- private async void ExecuteMoveToCommand( )
|
|
|
+ private void ExecuteMoveToCommand()
|
|
|
{
|
|
|
- await Task.Run( ( ) =>
|
|
|
+ this.messageController.ShowConfirmationPopupView($"Clamp Move To {this.SelectedPosition}", r =>
|
|
|
{
|
|
|
- //Axis.Move(this.SelectPosition);
|
|
|
- } );
|
|
|
+ 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;
|
|
|
+
|
|
|
+ this.PublishEvent(msg);
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
- private void ExecuteSelectPosCommand( object obj )
|
|
|
+ private void ExecuteSelectPosCommand(object obj)
|
|
|
{
|
|
|
this.SelectedPosition = obj.ToString();
|
|
|
|
|
|
- switch ( this.SelectedPosition )
|
|
|
+ if (obj.Equals(ConstString.TEACH_POSITION_LOCK))
|
|
|
+ {
|
|
|
+ this.PosLockBrush = Brushes.Orange;
|
|
|
+ this.PosUnlockBrush = Brushes.Gray;
|
|
|
+ }
|
|
|
+ else
|
|
|
{
|
|
|
- case "Lock":
|
|
|
- break;
|
|
|
- case "UnLock":
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
+ this.PosLockBrush = Brushes.Gray;
|
|
|
+ this.PosUnlockBrush = Brushes.Orange;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void ExecuteSelectAxisCommand( object obj )
|
|
|
+ private void ExecuteSelectAxisCommand(object obj)
|
|
|
{
|
|
|
- this.SelectAxis = obj.ToString();
|
|
|
+ if (obj.ToString().Equals(ConstString.AXIS_CARRIER_LOCK_LEFT))
|
|
|
+ {
|
|
|
+ this.LeftAxisBrush = Brushes.Orange;
|
|
|
+ this.RightAxisBrush = System.Windows.Media.Brushes.Gray;
|
|
|
+ this.SelectAxis = ConstString.AXIS_CARRIER_LOCK_LEFT;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ this.RightAxisBrush = Brushes.Orange;
|
|
|
+ this.LeftAxisBrush = System.Windows.Media.Brushes.Gray;
|
|
|
+ this.SelectAxis = ConstString.AXIS_CARRIER_LOCK_RIGHT;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
#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(UICallbackCommunication);
|
|
|
}
|
|
|
|
|
|
- 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
|
|
|
}
|