_Combobox.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Data; // DataRowCollection
  6. using System.Collections; // ArrayList
  7. namespace IControls_FireManager
  8. {
  9. // 콤보 박스 공통 루틴은 여기에서 구현한다
  10. public static class _Combobox
  11. {
  12. ///
  13. /// 콤보 박스 아이템 처리
  14. ///
  15. // 추가
  16. public static void Add(Janus.Windows.EditControls.UIComboBox uicombobox, string data)
  17. {
  18. try
  19. {
  20. //먼저, 클리어하고 콤보박스에 넣어준다.
  21. //uicombobox.Items.Clear();
  22. // 널값 허용하지 않는다
  23. if (data != null)
  24. {
  25. // 중복허용하지 않는다
  26. if (uicombobox.Items.Contains(data) == false)
  27. uicombobox.Items.Add(data);
  28. }
  29. }
  30. catch (Exception e)
  31. {
  32. _Event.DebugView_SendMessage_Write(e.ToString());
  33. }
  34. }
  35. ///
  36. /// 초기화시 콤보박스에 아이템을 추가한 후, 보여지는 글자가 첫번째 인덱스 0 으로 하는 경우
  37. ///
  38. // string 자료 초기화 ( "test0;test1")
  39. public static void Initialize(Janus.Windows.EditControls.UIComboBox uicombobox, string str)
  40. {
  41. try
  42. {
  43. //먼저, 클리어하고 콤보박스에 넣어준다.
  44. uicombobox.Items.Clear();
  45. // 데이터가 없다면 허용하지 않는다
  46. if (str != null)
  47. {
  48. // 문자열을 배열로
  49. string[] Data = _Convert.String_to_ArrayString(str);
  50. if (Data.Length != 0)
  51. {
  52. foreach (string data in Data)
  53. {
  54. // 널값 및 공백은 허용하지 않는다
  55. if ((data != null) && data.ToString().Length != 0)
  56. // 중복허용하지 않는다
  57. if (uicombobox.Items.Contains(data.ToString()) == false)
  58. uicombobox.Items.Add(data.ToString());
  59. }
  60. }
  61. }
  62. // 초기화시 콤보박스는 첫번째 인덱스
  63. uicombobox.SelectedIndex = 0;
  64. }
  65. catch (Exception e)
  66. {
  67. _Event.DebugView_SendMessage_Write(e.ToString());
  68. }
  69. }
  70. // string 자료 초기화 ( "test0|test1") -> | 구분자 지정
  71. public static void Initialize(Janus.Windows.EditControls.UIComboBox uicombobox, char [] spilt, string str)
  72. {
  73. try
  74. {
  75. //먼저, 클리어하고 콤보박스에 넣어준다.
  76. uicombobox.Items.Clear();
  77. // 데이터가 없다면 허용하지 않는다
  78. if (str != null)
  79. {
  80. // 문자열을 배열로
  81. string[] Data = _Convert.String_to_ArrayString(spilt, str);
  82. if (Data.Length != 0)
  83. {
  84. foreach (string data in Data)
  85. {
  86. // 널값 및 공백은 허용하지 않는다
  87. if ((data != null) && data.ToString().Length != 0)
  88. // 중복허용하지 않는다
  89. if (uicombobox.Items.Contains(data.ToString()) == false)
  90. uicombobox.Items.Add(data.ToString());
  91. }
  92. }
  93. }
  94. // 초기화시 콤보박스는 첫번째 인덱스
  95. uicombobox.SelectedIndex = 0;
  96. }
  97. catch (Exception e)
  98. {
  99. _Event.DebugView_SendMessage_Write(e.ToString());
  100. }
  101. }
  102. // DataRowCollection 자료 초기화
  103. public static void Initialize(Janus.Windows.EditControls.UIComboBox uicombobox, DataRowCollection datarows, int index)
  104. {
  105. try
  106. {
  107. //먼저, 클리어하고 콤보박스에 넣어준다.
  108. uicombobox.Items.Clear();
  109. // 데이터가 없다면 허용하지 않는다
  110. if (datarows != null)
  111. {
  112. foreach (DataRow data in datarows)
  113. {
  114. // 널값 및 공백은 허용하지 않는다
  115. if ((data != null) && data.ToString().Length != 0)
  116. // 중복허용하지 않는다
  117. if (uicombobox.Items.Contains(data[index].ToString()) == false)
  118. uicombobox.Items.Add(data[index].ToString());
  119. }
  120. }
  121. // 초기화시 콤보박스는 첫번째 인덱스
  122. uicombobox.SelectedIndex = 0;
  123. }
  124. catch (Exception e)
  125. {
  126. _Event.DebugView_SendMessage_Write(e.ToString());
  127. }
  128. }
  129. // Arraylist 자료 초기화
  130. public static void Initialize(Janus.Windows.EditControls.UIComboBox uicombobox, ArrayList arraylist)
  131. {
  132. try
  133. {
  134. //먼저, 클리어하고 콤보박스에 넣어준다.
  135. uicombobox.Items.Clear();
  136. // 데이터가 없다면 허용하지 않는다
  137. if (arraylist != null)
  138. {
  139. if (arraylist.Count != 0)
  140. {
  141. foreach (string data in arraylist)
  142. {
  143. // 널값 및 공백은 허용하지 않는다
  144. if ((data != null) && data.ToString().Length != 0)
  145. // 중복허용하지 않는다
  146. if (uicombobox.Items.Contains(data.ToString()) == false)
  147. uicombobox.Items.Add(data.ToString());
  148. }
  149. }
  150. }
  151. // 초기화시 콤보박스는 첫번째 인덱스
  152. uicombobox.SelectedIndex = 0;
  153. }
  154. catch (Exception e)
  155. {
  156. _Event.DebugView_SendMessage_Write(e.ToString());
  157. }
  158. }
  159. ///
  160. /// 초기화시 콤보박스에 아이템을 추가한 후, 보여지는 글자를 직접 지정하는 경우
  161. ///
  162. // string 자료 초기화 ( "test0;test1")
  163. public static void Initialize(Janus.Windows.EditControls.UIComboBox uicombobox, string str, string FirstDisplayText)
  164. {
  165. try
  166. {
  167. //먼저, 클리어하고 콤보박스에 넣어준다.
  168. uicombobox.Items.Clear();
  169. // 데이터가 없다면 허용하지 않는다
  170. if (str != null)
  171. {
  172. // 문자열을 배열로
  173. string[] Data = _Convert.String_to_ArrayString(str);
  174. if (Data.Length != 0)
  175. {
  176. foreach (string data in Data)
  177. {
  178. // 널값 및 공백은 허용하지 않는다
  179. if ((data != null) && data.ToString().Length != 0)
  180. // 중복허용하지 않는다
  181. if (uicombobox.Items.Contains(data.ToString()) == false)
  182. uicombobox.Items.Add(data.ToString());
  183. }
  184. }
  185. }
  186. // 초기화시 콤보박스에 보여질 텍스트
  187. uicombobox.Text = FirstDisplayText;
  188. }
  189. catch (Exception e)
  190. {
  191. _Event.DebugView_SendMessage_Write(e.ToString());
  192. }
  193. }
  194. // DataRowCollection 자료 초기화
  195. public static void Initialize(Janus.Windows.EditControls.UIComboBox uicombobox, DataRowCollection datarows, int index, string FirstDisplayText)
  196. {
  197. try
  198. {
  199. //먼저, 클리어하고 콤보박스에 넣어준다.
  200. uicombobox.Items.Clear();
  201. // 데이터가 없다면 허용하지 않는다
  202. if (datarows != null)
  203. {
  204. foreach (DataRow data in datarows)
  205. {
  206. // 널값 및 공백은 허용하지 않는다
  207. if ((data != null) && data.ToString().Length != 0)
  208. // 중복허용하지 않는다
  209. if (uicombobox.Items.Contains(data[index].ToString()) == false)
  210. uicombobox.Items.Add(data[index].ToString());
  211. }
  212. }
  213. // 초기화시 콤보박스에 보여질 텍스트
  214. uicombobox.Text = FirstDisplayText;
  215. }
  216. catch (Exception e)
  217. {
  218. _Event.DebugView_SendMessage_Write(e.ToString());
  219. }
  220. }
  221. // Arraylist 자료 초기화
  222. public static void Initialize(Janus.Windows.EditControls.UIComboBox uicombobox, ArrayList arraylist, string FirstDisplayText)
  223. {
  224. try
  225. {
  226. //먼저, 클리어하고 콤보박스에 넣어준다.
  227. uicombobox.Items.Clear();
  228. // 데이터가 없다면 허용하지 않는다
  229. if (arraylist != null)
  230. {
  231. if (arraylist.Count != 0)
  232. {
  233. foreach (string data in arraylist)
  234. {
  235. // 널값 및 공백은 허용하지 않는다
  236. if ((data != null) && data.ToString().Length != 0)
  237. // 중복허용하지 않는다
  238. if (uicombobox.Items.Contains(data.ToString()) == false)
  239. uicombobox.Items.Add(data.ToString());
  240. }
  241. }
  242. }
  243. // 초기화시 콤보박스에 보여질 텍스트
  244. uicombobox.Text = FirstDisplayText;
  245. }
  246. catch (Exception e)
  247. {
  248. _Event.DebugView_SendMessage_Write(e.ToString());
  249. }
  250. }
  251. }
  252. }