public void OpenGUI() { Close(); foreach (Form openForm in Application.OpenForms) { if (openForm.Name == "시리얼통신 테스트 프로그램") // 중복실행 방지 { if (openForm.WindowState == FormWindowState.Minimized) { openForm.WindowState = FormWindowState.Normal; } openForm.Activate(); } } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); SerialForm sf = new SerialForm(spPort, spBaudRate); sf.SerialForm_ClosEvent += serialFormCloseEventMethod; Application.Run(sf); writer = new Thread(new ThreadStart(Write)); writer.Start(); Open(); }
static void Main(string[] args) { #if (GUI) Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); SerialForm sf = new SerialForm(); Application.Run(sf); #else Serial sp = new Serial(args); // 해당 객체를 생성하고, start sp.Open(); sp.Start(); #endif }