diff --git a/Machines/ILSOS_CCW_H52A/EquipmentSetup.cs b/Machines/ILSOS_CCW_H52A/EquipmentSetup.cs index 0a7fcb3..c3f2f7c 100644 --- a/Machines/ILSOS_CCW_H52A/EquipmentSetup.cs +++ b/Machines/ILSOS_CCW_H52A/EquipmentSetup.cs @@ -91,34 +91,34 @@ namespace ILSOS_CCW_H52A var seq = AuroraEnv.SequenceEntry[SequenceIds.SeqAutoRunCCWH52A] as ISequence; seq.RunStateChanged += AutoRunSeq_RunStateChanged; } + private void ApplyRecipeByState(bool bON) + { + Application.Current.Dispatcher.Invoke(() => { + if (bON == false) + WeldingRecipeManager.OnActiveReloaded(); + else + WeldingRecipeManager.ReloadWeldingRecipe(WeldingRecipeManager.SelectedRecipe.name); + }); + } private void AutoRunSeq_RunStateChanged(object sender, (string sequenceId, SequenceRunState state) e) { //AutoRun 상황에서 Recipe Save Lock AuroraEnv.RecipeManager.SaveLock(CommonRecipeIds.ScannerObjectTeaching, e.state != SequenceRunState.Idle); - //AutoRun 상황에서 Reicpe 화면 수정할 수 없도록 함 - Application.Current.Dispatcher.Invoke(() => { - // Running으로 변경되면 Active된 레시피로 변경하도록 함 - if (e.state == SequenceRunState.Running) { - WeldingRecipeManager.OnActiveReloaded(); - } - - _UCRecipe.IsEnabled = e.state != SequenceRunState.Running; - }); + bool AutoRunState = e.state == SequenceRunState.Running; + ApplyRecipeByState(AutoRunState); + _UCRecipe.IsEnabled = e.state != SequenceRunState.Running; } private void OnPermissionChanged(EventMessage message) { - bool LoginState = ApplicationExt.PermissionLevel <= (ushort)PermissionLevel.LEVEL3; - if (LoginState == false) { - // Login 권한이 없어지면 Active된 레시피로 변경하도록 함 - Application.Current.Dispatcher.Invoke(() => { - WeldingRecipeManager.OnActiveReloaded(); - }); - } + bool permissionOn = ApplicationExt.PermissionLevel <= (ushort)PermissionLevel.LEVEL3; + AuroraEnv.RecipeManager.SaveLock(CommonRecipeIds.ScannerObjectTeaching, !permissionOn); + + // Login 권한이 없어지면 Active된 레시피로 변경하도록 함 + ApplyRecipeByState(permissionOn); //LogOut 상황에서 Recipe Save Lock - AuroraEnv.RecipeManager.SaveLock(CommonRecipeIds.ScannerObjectTeaching, !LoginState); //LogOut 상황에서 Reicpe 화면 수정할 수 없도록 함 - Application.Current.Dispatcher.Invoke(() => { _UCRecipe.IsEnabled = LoginState; }); + Application.Current.Dispatcher.Invoke(() => { _UCRecipe.IsEnabled = permissionOn; }); } // For Selection LaserDevice