Frame_Debug.cs 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. namespace IControls_FireManager
  10. {
  11. public partial class Frame_Debug : Form
  12. {
  13. // 디버그 창 표시
  14. delegate void DebugEditBox_SetTextCallback(string Data);
  15. public Frame_Debug()
  16. {
  17. ///
  18. /// 초기화
  19. ///
  20. InitializeComponent();
  21. ///
  22. /// 이벤트
  23. ///
  24. // 디버그 메세지 이벤트 핸들러 등록
  25. _Event.DebugView_SendMessage_Event += new _Event.DebugView_SendMessage_Handler(_Event_DebugView_SendMessage_Event);
  26. // 폼닫기 이벤트를 등록 (이벤트 핸들러 해제용)
  27. this.FormClosing += new FormClosingEventHandler(CreateForm_FormClosing);
  28. // 윈도우 스타일 변경 이벤트 핸들러 등록
  29. _Event.WindowStyleSet_SendMessage_Event += new _Event.WindowStyleSet_SendMessage_Handler(_Event_WindowStyleSet_SendMessage_Event);
  30. ///
  31. /// 스타일 변경
  32. ///
  33. UI_Style_Initialize();
  34. uiCheckBox_LogEnable.Checked = true;
  35. ///
  36. /// LOG 시작
  37. ///
  38. _Event_DebugView_SendMessage_Event(_Text.LOG_StartProgram);
  39. }
  40. // 폼닫기 이벤트를 등록 (이벤트 핸들러 해제용)
  41. public void CreateForm_FormClosing(object sender, FormClosingEventArgs e)
  42. {
  43. _Event.WindowStyleSet_SendMessage_Event -= new _Event.WindowStyleSet_SendMessage_Handler(_Event_WindowStyleSet_SendMessage_Event);
  44. }
  45. // 디버그 메세지 이벤트
  46. public void _Event_DebugView_SendMessage_Event(string Data)
  47. {
  48. if(this.uiCheckBox_LogEnable.Checked == true)
  49. Delegate_Set_Log(Data);
  50. }
  51. // 디버그 메세지 이벤트
  52. private void Delegate_Set_Log(string Data)
  53. {
  54. if (this.editBox_Log.InvokeRequired)
  55. {
  56. DebugEditBox_SetTextCallback d = new DebugEditBox_SetTextCallback(Delegate_Set_Log);
  57. this.Invoke(d, new object[] { Data });
  58. }
  59. else
  60. {
  61. this.editBox_Log.AppendText(_Text.LeftBracket + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + _Text.RightBracket + _Text.Blank + Data + _Text.CarrageReturn);
  62. }
  63. }
  64. // 윈도우 스타일 변경 이벤트
  65. public void _Event_WindowStyleSet_SendMessage_Event()
  66. {
  67. UI_Style_Initialize();
  68. }
  69. // 스타일 초기화 함수
  70. private void UI_Style_Initialize()
  71. {
  72. this.officeFormAdorner.Office2007ColorScheme = _Data.Style_Office2007ColorScheme;
  73. this.editBox_Log.VisualStyle = _Style.Get_GridEXVisualStyle(_Data.Style_VisualStyle.ToString());
  74. }
  75. // 저장버튼
  76. private void uiButton_Save_Click(object sender, EventArgs e)
  77. {
  78. _File.Delete_Log();
  79. _File.Write_Log(this.editBox_Log.Text);
  80. _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.OK, 650, 150, _File.ProgramPath + _File.ProgramFileName_Log_Error + _Text.Savelog, 0);
  81. }
  82. // 화면 클리어
  83. private void uiButton_Clear_Click(object sender, EventArgs e)
  84. {
  85. this.editBox_Log.Text = null;
  86. }
  87. // 클립보드 복사
  88. private void uiButton_Copy_Click(object sender, EventArgs e)
  89. {
  90. Clipboard.Clear();
  91. Clipboard.SetText(this.editBox_Log.Text);
  92. _Popup.Create(Popup_Type.Confirm, Popup_Style.Normal, _Text.OK, 350, 150,_Text.SaveClipboard, 0);
  93. }
  94. // 색지정
  95. private void uiComboBox_Color_SelectedItemChanged(object sender, EventArgs e)
  96. {
  97. switch(this.uiComboBox_Color.Text)
  98. {
  99. case "White":
  100. this.editBox_Log.ForeColor = Color.White;
  101. break;
  102. case "Blue":
  103. this.editBox_Log.ForeColor = Color.Blue;
  104. break;
  105. case "Yellow":
  106. this.editBox_Log.ForeColor = Color.Yellow;
  107. break;
  108. case "Red":
  109. this.editBox_Log.ForeColor = Color.Red;
  110. break;
  111. }
  112. this.editBox_Log.ResumeLayout();
  113. }
  114. private void uiComboBox_FontSize_SelectedIndexChanged(object sender, EventArgs e)
  115. {
  116. switch (this.uiComboBox_FontSize.Text)
  117. {
  118. case "8":
  119. this.editBox_Log.Font = new System.Drawing.Font("굴림", 8F);
  120. break;
  121. case "10":
  122. this.editBox_Log.Font = new System.Drawing.Font("굴림", 10F);
  123. break;
  124. case "12":
  125. this.editBox_Log.Font = new System.Drawing.Font("굴림", 12F);
  126. break;
  127. case "14":
  128. this.editBox_Log.Font = new System.Drawing.Font("굴림", 14F);
  129. break;
  130. case "16":
  131. this.editBox_Log.Font = new System.Drawing.Font("굴림", 16F);
  132. break;
  133. }
  134. this.editBox_Log.ResumeLayout();
  135. }
  136. }
  137. }