bc7afebcbccdbf652930fa083a3cc037aaebfe35.svn-base 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. namespace FPER
  9. {
  10. public partial class frmModalIdInputIO : Form
  11. {
  12. public frmModalIdInputIO()
  13. {
  14. InitializeComponent();
  15. }
  16. //입력값을 받고, 넘기기위한 VO
  17. private InputIDVo inputVo;
  18. public InputIDVo InputVo { get { return this.inputVo; } set { this.inputVo = value; } }
  19. //화면이동을 위해---------------
  20. private Boolean MoveOK = true;
  21. private Point mouseOffset;
  22. //--------------------------------------------------------
  23. // 라디오버튼 선택값
  24. int m_iSelected;
  25. /********************************************************/
  26. /* MdiParent 화면이동 */
  27. /********************************************************/
  28. private void frmIdInputIOModal_MouseDown(object sender, MouseEventArgs e)
  29. {
  30. try
  31. {
  32. if (MoveOK)
  33. {
  34. mouseOffset = new Point(-e.X, -e.Y);
  35. }
  36. }
  37. catch (Exception ex)
  38. {
  39. Util.UErrorMessage(ex, 0, 0);
  40. }
  41. }
  42. private void frmIdInputIOModal_MouseMove(object sender, MouseEventArgs e)
  43. {
  44. try
  45. {
  46. if (MoveOK && (e.Button == MouseButtons.Left))
  47. {
  48. Point mousePos = Control.MousePosition;
  49. mousePos.Offset(mouseOffset.X, mouseOffset.Y);
  50. this.Location = mousePos;
  51. }
  52. }
  53. catch (Exception ex)
  54. {
  55. Util.UErrorMessage(ex, 0, 0);
  56. }
  57. }
  58. /********************************************************/
  59. private void btnClose_Click(object sender, EventArgs e)
  60. {
  61. try
  62. {
  63. this.inputVo.InputOK = false;
  64. this.Close();
  65. }
  66. catch (Exception ex)
  67. {
  68. Util.UErrorMessage(ex, 0, 0);
  69. }
  70. }
  71. private void btnOK_Click(object sender, EventArgs e)
  72. {
  73. try
  74. {
  75. inputVo.ReceiverID = (int)(num_ReceiverID.Value);
  76. inputVo.BoardID = (int)(num_CommBoardID.Value);
  77. inputVo.DeviceID = (int)(num_RepeaterID.Value);
  78. if (m_iSelected == 0)
  79. {
  80. inputVo.InoutType = code_InOutType.Input;
  81. }
  82. else
  83. {
  84. inputVo.InoutType = code_InOutType.Output;
  85. }
  86. /*
  87. this.inputVo.ReceiverID = Util.StrToInt(this.txtReceiverID.Text, inputVo.ReceiverID);
  88. this.inputVo.BoardID = Util.StrToInt(this.txtBoardID.Text, inputVo.BoardID);
  89. this.inputVo.DeviceID = Util.StrToInt(this.txtDeviceID.Text, inputVo.DeviceID);
  90. this.inputVo.InoutType = rdoInputType.Checked ? code_InOutType.Input : code_InOutType.Output;
  91. */
  92. this.inputVo.InputOK = true;
  93. this.Close();
  94. }
  95. catch (Exception ex)
  96. {
  97. Util.UErrorMessage(ex, 0, 0);
  98. }
  99. }
  100. private void frmIdInputIOModal_Load(object sender, EventArgs e)
  101. {
  102. if (inputVo != null)
  103. {
  104. num_RepeaterID.Value = inputVo.RepeaterID;
  105. num_CommBoardID.Value = inputVo.BoardID;
  106. num_RepeaterID.Value = inputVo.DeviceID;
  107. if (inputVo.InoutType.Equals(code_InOutType.Input))
  108. rdoInput.Checked = true;
  109. else
  110. rdoOutput.Checked = true;
  111. // 이게 왜 있을까..??
  112. /*
  113. if (inputVo.BoardID > 0)
  114. {
  115. num_CommBoardID.ReadOnly = true;
  116. num_CommBoardID.Enabled = false;
  117. }
  118. */
  119. }
  120. /*
  121. try {
  122. if (inputVo != null)
  123. {
  124. txtReceiverID.Text = String.Format("{0:00}", inputVo.ReceiverID);
  125. txtBoardID.Text = String.Format("{0:00}", inputVo.BoardID);
  126. if (inputVo.InoutType.Equals(code_InOutType.Input))
  127. rdoInputType.Checked = true;
  128. else
  129. rdoOutputType.Checked = true;
  130. if (inputVo.BoardID > 0)
  131. {
  132. txtBoardID.ReadOnly = true;
  133. btnBoardIDUp.Enabled = false;
  134. btnBoardIDDown.Enabled = false;
  135. }
  136. txtDeviceID.Text = String.Format("{0:00}", inputVo.DeviceID);
  137. }
  138. }
  139. catch (Exception ex) {
  140. Util.UErrorMessage(ex, 0, 0);
  141. }
  142. */
  143. }
  144. private void frmIdInputIOModal_Paint(object sender, PaintEventArgs e)
  145. {
  146. /*
  147. try {
  148. Graphics g = e.Graphics;
  149. Pen p = new Pen(Color.DarkGray, 3);
  150. Form gb = sender as Form;
  151. Rectangle rt = new Rectangle(gb.Location, gb.Size);
  152. g.DrawLine(p, 6, 0, 3, 0);
  153. g.DrawLine(p, 3, 0, 0, 6);
  154. g.DrawLine(p, 0, 6, 0, rt.Height - 4);
  155. g.DrawLine(p, 0, rt.Height - 4, 3, rt.Height - 1);
  156. g.DrawLine(p, 3, rt.Height - 1, rt.Width - 5, rt.Height - 1);
  157. g.DrawLine(p, rt.Width - 5, rt.Height - 1, rt.Width - 1, rt.Height - 5);
  158. g.DrawLine(p, rt.Width - 1, rt.Height - 5, rt.Width - 1, 6);
  159. g.DrawLine(p, rt.Width - 1, 6, rt.Width - 5, 0);
  160. g.DrawLine(p, rt.Width - 5, 0, 6, 0);
  161. }
  162. catch (Exception ex) {
  163. Util.UErrorMessage(ex, 0, 0);
  164. }
  165. */
  166. }
  167. /*
  168. private void btnReceiverIDUp_Click(object sender, EventArgs e)
  169. {
  170. try {
  171. int val = Util.StrToInt(txtReceiverID.Text, 0);
  172. val++;
  173. txtReceiverID.Text = String.Format("{0:00}", val);
  174. }
  175. catch (Exception ex) {
  176. Util.UErrorMessage(ex, 0, 0);
  177. }
  178. }
  179. private void btnReceiverIDDown_Click(object sender, EventArgs e)
  180. {
  181. try {
  182. int val = Util.StrToInt(txtReceiverID.Text, 0);
  183. val--;
  184. txtReceiverID.Text = String.Format("{0:00}", val);
  185. }
  186. catch (Exception ex) {
  187. Util.UErrorMessage(ex, 0, 0);
  188. }
  189. }
  190. private void btnBoardIDUp_Click(object sender, EventArgs e)
  191. {
  192. try {
  193. int val = Util.StrToInt(txtBoardID.Text, 0);
  194. val++;
  195. txtBoardID.Text = String.Format("{0:00}", val);
  196. }
  197. catch (Exception ex) {
  198. Util.UErrorMessage(ex, 0, 0);
  199. }
  200. }
  201. private void btnBoardIDDown_Click(object sender, EventArgs e)
  202. {
  203. try {
  204. int val = Util.StrToInt(txtBoardID.Text, 0);
  205. val--;
  206. if (val < 0) val = 0;
  207. txtBoardID.Text = String.Format("{0:00}", val);
  208. }
  209. catch (Exception ex) {
  210. Util.UErrorMessage(ex, 0, 0);
  211. }
  212. }
  213. private void btnDeviceIDUp_Click(object sender, EventArgs e)
  214. {
  215. try {
  216. int val = Util.StrToInt(txtDeviceID.Text, 0);
  217. val++;
  218. //if (val > 8) val = 8;
  219. txtDeviceID.Text = String.Format("{0:00}", val);
  220. }
  221. catch (Exception ex) {
  222. Util.UErrorMessage(ex, 0, 0);
  223. }
  224. }
  225. private void btnDeviceIDDown_Click(object sender, EventArgs e)
  226. {
  227. try {
  228. int val = Util.StrToInt(txtDeviceID.Text, 0);
  229. val--;
  230. if (val < 0) val = 0;
  231. txtDeviceID.Text = String.Format("{0:00}", val);
  232. }
  233. catch (Exception ex) {
  234. Util.UErrorMessage(ex, 0, 0);
  235. }
  236. }
  237. */
  238. private void rdoOutput_CheckedChanged(object sender, EventArgs e)
  239. {
  240. RadioButton rb = (RadioButton)sender;
  241. m_iSelected = int.Parse(rb.Tag.ToString());
  242. }
  243. }
  244. }