using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace IControls_FireManager { public partial class Frame_Debug : Form { // 디버그 창 표시 delegate void DebugEditBox_SetTextCallback(string Data); public Frame_Debug() { /// /// 초기화 /// InitializeComponent(); /// /// 이벤트 /// // 디버그 메세지 이벤트 핸들러 등록 _Event.DebugView_SendMessage_Event += new _Event.DebugView_SendMessage_Handler(_Event_DebugView_SendMessage_Event); // 폼닫기 이벤트를 등록 (이벤트 핸들러 해제용) this.FormClosing += new FormClosingEventHandler(CreateForm_FormClosing); // 윈도우 스타일 변경 이벤트 핸들러 등록 _Event.WindowStyleSet_SendMessage_Event += new _Event.WindowStyleSet_SendMessage_Handler(_Event_WindowStyleSet_SendMessage_Event); /// /// 스타일 변경 /// UI_Style_Initialize(); uiCheckBox_LogEnable.Checked = true; /// /// LOG 시작 /// _Event_DebugView_SendMessage_Event(_Text.LOG_StartProgram); } // 폼닫기 이벤트를 등록 (이벤트 핸들러 해제용) public void CreateForm_FormClosing(object sender, FormClosingEventArgs e) { _Event.WindowStyleSet_SendMessage_Event -= new _Event.WindowStyleSet_SendMessage_Handler(_Event_WindowStyleSet_SendMessage_Event); } // 디버그 메세지 이벤트 public void _Event_DebugView_SendMessage_Event(string Data) { if(this.uiCheckBox_LogEnable.Checked == true) Delegate_Set_Log(Data); } // 디버그 메세지 이벤트 private void Delegate_Set_Log(string Data) { if (this.editBox_Log.InvokeRequired) { DebugEditBox_SetTextCallback d = new DebugEditBox_SetTextCallback(Delegate_Set_Log); this.Invoke(d, new object[] { Data }); } else { this.editBox_Log.AppendText(_Text.LeftBracket + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + _Text.RightBracket + _Text.Blank + Data + _Text.CarrageReturn); } } // 윈도우 스타일 변경 이벤트 public void _Event_WindowStyleSet_SendMessage_Event() { UI_Style_Initialize(); } // 스타일 초기화 함수 private void UI_Style_Initialize() { this.officeFormAdorner.Office2007ColorScheme = _Data.Style_Office2007ColorScheme; this.editBox_Log.VisualStyle = _Style.Get_GridEXVisualStyle(_Data.Style_VisualStyle.ToString()); } // 저장버튼 private void uiButton_Save_Click(object sender, EventArgs e) { _File.Delete_Log(); _File.Write_Log(this.editBox_Log.Text); _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.OK, 650, 150, _File.ProgramPath + _File.ProgramFileName_Log_Error + _Text.Savelog, 0); } // 화면 클리어 private void uiButton_Clear_Click(object sender, EventArgs e) { this.editBox_Log.Text = null; } // 클립보드 복사 private void uiButton_Copy_Click(object sender, EventArgs e) { Clipboard.Clear(); Clipboard.SetText(this.editBox_Log.Text); _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.OK, 350, 150,_Text.SaveClipboard, 0); } // 색지정 private void uiComboBox_Color_SelectedItemChanged(object sender, EventArgs e) { switch(this.uiComboBox_Color.Text) { case "White": this.editBox_Log.ForeColor = Color.White; break; case "Blue": this.editBox_Log.ForeColor = Color.Blue; break; case "Yellow": this.editBox_Log.ForeColor = Color.Yellow; break; case "Red": this.editBox_Log.ForeColor = Color.Red; break; } this.editBox_Log.ResumeLayout(); } private void uiComboBox_FontSize_SelectedIndexChanged(object sender, EventArgs e) { switch (this.uiComboBox_FontSize.Text) { case "8": this.editBox_Log.Font = new System.Drawing.Font("굴림", 8F); break; case "10": this.editBox_Log.Font = new System.Drawing.Font("굴림", 10F); break; case "12": this.editBox_Log.Font = new System.Drawing.Font("굴림", 12F); break; case "14": this.editBox_Log.Font = new System.Drawing.Font("굴림", 14F); break; case "16": this.editBox_Log.Font = new System.Drawing.Font("굴림", 16F); break; } this.editBox_Log.ResumeLayout(); } } }