사용자 조작 시 Log 추가

This commit is contained in:
최민영 2026-03-17 16:07:19 +09:00
parent d8f13d07e4
commit 9265b22328
3 changed files with 75 additions and 37 deletions

View File

@ -44,12 +44,10 @@ using WeldingCommon.Views;
using WeldingCommon.Vision.Factory;
using static WeldingCommon.Vision.Factory.VisionFactory;
namespace ILSOS_CCW_H52A
{
internal class EquipmentSetup : CommonEquipmentSetup, IEquipmentSetup
{
namespace ILSOS_CCW_H52A {
internal class EquipmentSetup : CommonEquipmentSetup, IEquipmentSetup {
private SequenceBuilder _SeqAutoRunCCWH52A_Builder;
public Logger Log = new Logger("EquipmentSetup");
public override void BuildMainStatusView(MainStatusBuilder builder)
{
base.BuildMainStatusView(builder);
@ -92,7 +90,7 @@ namespace ILSOS_CCW_H52A
var seq = AuroraEnv.SequenceEntry[SequenceIds.SeqAutoRunCCWH52A] as ISequence;
seq.RunStateChanged += AutoRunSeq_RunStateChanged;
}
private void AutoRunSeq_RunStateChanged(object sender, (string sequenceId, SequenceRunState state) e)
{
//AutoRun 상황에서 Recipe Save Lock
@ -103,15 +101,23 @@ namespace ILSOS_CCW_H52A
WeldingRecipeManager.OnActiveReloaded();
else
WeldingRecipeManager.ReloadWeldingRecipe(WeldingRecipeManager.SelectedRecipe.name);
_UCRecipe.IsEnabled = e.state != SequenceRunState.Running;
});
Application.Current.Dispatcher.Invoke(() => {
if (AutoRunState)
Log.E($"AutoRun Start. Recipe Lock Enable True");
else
Log.E("AutoRun End. Recipe Lock Enable False");
});
}
private void OnPermissionChanged(EventMessage message)
{
bool permissionOn = ApplicationExt.PermissionLevel <= (ushort)PermissionLevel.LEVEL3;
AuroraEnv.RecipeManager.SaveLock(CommonRecipeIds.ScannerObjectTeaching, !permissionOn);
// Login 권한이 없어지면 Active된 레시피로 변경하도록 함
Application.Current.Dispatcher.Invoke(() => {
if (!permissionOn)
@ -123,6 +129,13 @@ namespace ILSOS_CCW_H52A
//LogOut 상황에서 Recipe Save Lock
//LogOut 상황에서 Reicpe 화면 수정할 수 없도록 함
Application.Current.Dispatcher.Invoke(() => { _UCRecipe.IsEnabled = permissionOn; });
Application.Current.Dispatcher.Invoke(() => {
if (!permissionOn)
Log.E($"User LogOut. Recipe Lock Enable True");
else
Log.E("User Login. Recipe Lock Enable False");
});
}
// For Selection LaserDevice

View File

@ -7,6 +7,7 @@ using System.Drawing;
using System.Drawing.Text;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Windows.Forms;
namespace CoreUnit.Control.UserControl.Canvas
@ -1309,7 +1310,7 @@ namespace CoreUnit.Control.UserControl.Canvas
if (m_commandType == eCommandType.select || m_commandType == eCommandType.move) {
m_commandType = eCommandType.pan;
}
Log.E("Recipe View Command Pan");
UpdateCursor();
}
@ -1323,11 +1324,16 @@ namespace CoreUnit.Control.UserControl.Canvas
public void CommandDeleteSelected()
{
StringBuilder sb = new StringBuilder();
if (m_model.SelectedCount > 0) {
foreach(var layer in m_model.SelectedObjects) {
sb.Append($"{layer.No + 1} ");
}
m_model.DeleteObjects(m_model.SelectedObjects);
m_model.ClearSelectedObjects();
DoInvalidate(true);
UpdateCursor();
Log.E($"Layer Delete Success. No. [{sb}]");
}
}
@ -1344,6 +1350,7 @@ namespace CoreUnit.Control.UserControl.Canvas
public void CommandScaleToFit()
{
Model.Zoom = ((DataModel)Model).ScaleToFit;
Log.E("Recipe View Scale to Fit");
DoInvalidate(true);
}
@ -1357,6 +1364,7 @@ namespace CoreUnit.Control.UserControl.Canvas
{
SetCenter(new UnitPoint(0, 0));
DoInvalidate(true);
Log.E("Recipe View Focus Center");
}
public void CommandZoomIn()
@ -1532,14 +1540,15 @@ namespace CoreUnit.Control.UserControl.Canvas
if ((System.Windows.Forms.Control.ModifierKeys & Keys.Control) == Keys.Control) {
if (e.KeyCode >= Keys.D1 && e.KeyCode <= Keys.D9) {
int id = e.KeyCode - Keys.D0;
//int id = e.KeyCode - Keys.D0;
foreach (var obj in m_model.ActiveLayer.Objects) {
if (obj.ScannerParamID == id)
m_model.AddSelectedObject(obj);
}
DoInvalidate(true);
// CMY - Arc를 선택하려고 하면 OverFlow 뜬다.. 확인 필요
//foreach (var obj in m_model.ActiveLayer.Objects) {
// if (obj.ScannerParamID == id)
// m_model.AddSelectedObject(obj);
//}
//Log.I($"Recipe View Parameter All Select. ID : {id}");
//DoInvalidate(true);
} else {
switch (e.KeyCode) {
case Keys.G:
@ -1549,6 +1558,7 @@ namespace CoreUnit.Control.UserControl.Canvas
case Keys.S:
RunningSnapsModeChange();
Log.E("Recipe View Key Input Save!");
break;
case Keys.Right:
@ -1556,6 +1566,7 @@ namespace CoreUnit.Control.UserControl.Canvas
float offsetValue = evtGetOffsetValue();
((DataModel)Model).RotateObjects((float)(-1 * offsetValue), Model.SelectedObjects, true);
DoInvalidate(true);
Log.E("Recipe View Key Input Right Rotate");
}
break;
@ -1564,56 +1575,69 @@ namespace CoreUnit.Control.UserControl.Canvas
float offsetValue = evtGetOffsetValue();
((DataModel)Model).RotateObjects((float)offsetValue, Model.SelectedObjects, true);
DoInvalidate(true);
Log.E("Recipe View Key Input Left Rotate");
}
break;
case Keys.C:
copies = new List<IDrawObject>();
StringBuilder Copy_sb = new StringBuilder();
foreach (IDrawObject obj in Model.SelectedObjects) {
copies.Add(obj.Clone());
Copy_sb.Append($"{obj.No + 1} ");
}
iterationOffsetValue = 0;
DoInvalidate(true);
Log.E($"Recipe View Layer Copy. No [{Copy_sb}]");
break;
case Keys.V:
if (copies.Count != 0) {
StringBuilder Paste_sb = new StringBuilder();
double offsetValue = 3;
((DataModel)Model).CopyObjects(new UnitPoint(iterationOffsetValue + offsetValue, iterationOffsetValue + offsetValue), copies);
iterationOffsetValue = iterationOffsetValue + offsetValue;
DoInvalidate(true);
foreach (var layer in copies) {
Paste_sb.Append($"{layer.No + 1} ");
}
Log.E($"Recipe View Layer Paste. No [{Paste_sb}]");
}
break;
case Keys.Z: //Undo
CommandDoUndo();
Log.E("Recipe View Do Undo");
break;
case Keys.Y: //Redo
CommandDoRedo();
Log.E("Recipe View Do Redo");
break;
//키보드로 객체 이동
case Keys.Up://선택된 객체를 지정된 위치값 만큼 상승
if (evtGetOffsetValue != null) {
float offsetValue = evtGetOffsetValue();
Model.MoveObjects(new UnitPoint(0, offsetValue), Model.SelectedObjects, true);
DoInvalidate(true);
}
break;
////키보드로 객체 이동
//case Keys.Up://선택된 객체를 지정된 위치값 만큼 상승
// if (evtGetOffsetValue != null) {
// float offsetValue = evtGetOffsetValue();
// Model.MoveObjects(new UnitPoint(0, offsetValue), Model.SelectedObjects, true);
// DoInvalidate(true);
// }
// break;
case Keys.Down://선택된 객체를 지정된 위치값 만큼 하강
if (evtGetOffsetValue != null) {
float offsetValue = evtGetOffsetValue();
Model.MoveObjects(new UnitPoint(0, -1 * offsetValue), Model.SelectedObjects, true);
DoInvalidate(true);
}
break;
//case Keys.Down://선택된 객체를 지정된 위치값 만큼 하강
// if (evtGetOffsetValue != null) {
// float offsetValue = evtGetOffsetValue();
// Model.MoveObjects(new UnitPoint(0, -1 * offsetValue), Model.SelectedObjects, true);
// DoInvalidate(true);
// }
// break;
case Keys.A:
foreach (var obj in m_model.ActiveLayer.Objects) {
m_model.AddSelectedObject(obj);
}
Log.E("Recipe View All Layer Select");
break;
}
@ -1664,7 +1688,7 @@ namespace CoreUnit.Control.UserControl.Canvas
if (evtGetOffsetValue != null) {
float offsetValue = evtGetOffsetValue();
Model.MoveObjects(new UnitPoint(0, offsetValue), Model.SelectedObjects, true);
Log.I($"Input Key Up, Layer Move. [X : 0, | Y : {offsetValue}]");
Log.E($"Input Key Up, Layer Move. [X : 0, | Y : {offsetValue}]");
DoInvalidate(true);
}
break;
@ -1673,7 +1697,7 @@ namespace CoreUnit.Control.UserControl.Canvas
if (evtGetOffsetValue != null) {
float offsetValue = evtGetOffsetValue();
Model.MoveObjects(new UnitPoint(0, -1 * offsetValue), Model.SelectedObjects, true);
Log.I($"Input Key Down, Layer Move. [X : 0, | Y : {-1 * offsetValue}]");
Log.E($"Input Key Down, Layer Move. [X : 0, | Y : {-1 * offsetValue}]");
DoInvalidate(true);
}
break;
@ -1682,7 +1706,7 @@ namespace CoreUnit.Control.UserControl.Canvas
if (evtGetOffsetValue != null) {
float offsetValue = evtGetOffsetValue();
Model.MoveObjects(new UnitPoint(offsetValue, 0), Model.SelectedObjects, true);
Log.I($"Input Key Right, Layer Move. [X : | Y : {offsetValue}, 0]");
Log.E($"Input Key Right, Layer Move. [X : {offsetValue} | Y : 0]");
DoInvalidate(true);
}
break;
@ -1691,7 +1715,7 @@ namespace CoreUnit.Control.UserControl.Canvas
if (evtGetOffsetValue != null) {
double offsetValue = evtGetOffsetValue();
Model.MoveObjects(new UnitPoint(-1 * offsetValue, 0), Model.SelectedObjects, true);
Log.I($"Input Key Left, Layer Move. [X : | Y : {-1 * offsetValue}, 0]");
Log.E($"Input Key Left, Layer Move. [X : {-1 * offsetValue} | Y : 0]");
DoInvalidate(true);
}
break;
@ -1700,7 +1724,7 @@ namespace CoreUnit.Control.UserControl.Canvas
if (evtGetAngleOffsetValue != null) {
float angleOffset = evtGetAngleOffsetValue();
((DataModel)Model).RotateObjects(-1 * (float)angleOffset, Model.SelectedObjects, true);
Log.I($"Input Key E, Angle Rotate");
Log.E($"Input Key E, Angle Rotate");
DoInvalidate(true);
}
break;
@ -1709,7 +1733,7 @@ namespace CoreUnit.Control.UserControl.Canvas
if (evtGetAngleOffsetValue != null) {
float angleOffset = evtGetAngleOffsetValue();
((DataModel)Model).RotateObjects((float)angleOffset, Model.SelectedObjects, true);
Log.I($"Input Key Q, Angle Rotate");
Log.E($"Input Key Q, Angle Rotate");
DoInvalidate(true);
}
break;

View File

@ -181,6 +181,7 @@ namespace WeldingCommon.Views
public void OnChanged((int id, string name) recipe)
{
Log.I($"Recipe Select. ID : {recipe.id}, Name : {recipe.name}");
if (WeldingRecipeManager.SelectedRecipe.id == recipe.id && WeldingRecipeManager.SelectedRecipe.name == recipe.name) {
return;
}