79 lines
2.3 KiB
C#
79 lines
2.3 KiB
C#
using Aurora;
|
|
using Microsoft.Win32;
|
|
using System.Windows;
|
|
|
|
namespace WeldingCommon.Views.DoorInterlock
|
|
{
|
|
public class DoorInterlockPopup
|
|
{
|
|
private WinDoorInterlock MaintPopup = null;
|
|
private readonly IAuroraEnvironment AuroraEnv;
|
|
|
|
|
|
private static DoorInterlockPopup _PopupManager = null;
|
|
public static DoorInterlockPopup GetInstance()
|
|
{
|
|
if (_PopupManager == null) {
|
|
_PopupManager = new DoorInterlockPopup();
|
|
}
|
|
return _PopupManager;
|
|
}
|
|
public DoorInterlockPopup()
|
|
{
|
|
AuroraEnv = Application.Current.AuroraEnv();
|
|
}
|
|
|
|
//GYN - MAINT
|
|
public bool CanPopupMaint()
|
|
{
|
|
if (MaintPopup != null) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public bool PopupMaint(string settingId)
|
|
{
|
|
if (!CanPopupMaint()) {
|
|
return false;
|
|
}
|
|
WinDoorInterlockViewModel viewModel = new WinDoorInterlockViewModel(AuroraEnv.SettingEntry, settingId);
|
|
#warning Popup할때, 윈도우 이벤트(ctrl + f4, alt + ctrl + delete...) 막는 로직
|
|
//fnEnableTaskManage(true);
|
|
MaintPopup = new WinDoorInterlock(viewModel);
|
|
MaintPopup.Owner = Application.Current.MainWindow;
|
|
MaintPopup.Show();
|
|
|
|
return true;
|
|
}
|
|
|
|
public void PopupMaintClose()
|
|
{
|
|
//fnEnableTaskManage(false);
|
|
if (MaintPopup != null) {
|
|
MaintPopup.Hide();
|
|
MaintPopup = null;
|
|
}
|
|
}
|
|
|
|
// 작업관리자 사용 불가능하도록 레지스트리 변경하는 함수
|
|
public void fnEnableTaskManage(bool enable)
|
|
{
|
|
RegistryKey regkey;
|
|
string subKey = @"Software\Microsoft\Windows\CurrentVersion\Policies\System";
|
|
if (enable) {
|
|
string keyValueInt = "1";
|
|
|
|
regkey = Registry.CurrentUser.CreateSubKey(subKey);
|
|
regkey.SetValue("DisableTaskMgr", keyValueInt);
|
|
regkey.Close();
|
|
} else {
|
|
regkey = Registry.CurrentUser;
|
|
RegistryKey SubKey = regkey.OpenSubKey(subKey);
|
|
if (SubKey != null)
|
|
regkey.DeleteSubKeyTree(subKey);
|
|
}
|
|
}
|
|
}
|
|
}
|