using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Collections; namespace IControls_FireManager { // 스레드 공용 루틴 public static class _Thread { // 스레드 관리 해쉬테이블 private static Hashtable CreatedThread = new Hashtable(); // 생성 (파라미터가 없는 타입 : 스레드 실행시에 필요한 데이터가 없다) public static void Create(string Key, ThreadStart WorkFunction) { if (CreatedThread.Contains(Key) == true) { _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 250, 150, _Text.OverLapKey, 0); } else { // 스레드 생성 Thread WorkingThread = new Thread(new ThreadStart(WorkFunction)); // 스레드시작 WorkingThread.Start(); // 해쉬에 추가 CreatedThread.Add(Key, WorkingThread); } } // 생성 (파라미터가 없는 타입 : 스레드 실행시에 필요한 데이터가 없다) public static void Create(string Key, ParameterizedThreadStart WorkFunction, object Data) { if (CreatedThread.Contains(Key) == true) { _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.Warnning, 250, 150, _Text.OverLapKey, 0); } else { // 스레드 생성 Thread WorkingThread = new Thread(new ParameterizedThreadStart(WorkFunction)); // 스레드시작 WorkingThread.Start(Data); // 해쉬에 추가 CreatedThread.Add(Key, WorkingThread); } } // 시작 public static void Start(string Key) { if (CreatedThread.Contains(Key) == true) { ((Thread)CreatedThread[Key]).Start(); } } // 종료 public static void Abort(string Key) { if (CreatedThread.Contains(Key) == true) { ((Thread)CreatedThread[Key]).Abort(); Delete(Key); _Event.DebugView_SendMessage_Write("스레드 중지!!!!"); } } // 삭제 public static void Delete(string Key) { if (CreatedThread.Contains(Key) == true) { CreatedThread.Remove(Key); } } } }