frmWaitingMsg.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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 frmWaitingMsg : Form
  11. {
  12. public frmWaitingMsg()
  13. {
  14. InitializeComponent();
  15. }
  16. MDIParent parent;
  17. //화면이동을 위해---------------
  18. private Boolean WinMove = true;
  19. private Point mouseOffset;
  20. //--------------------------------------------------------
  21. public void Form_Init()
  22. {
  23. progressBar1.Value = 0;
  24. progressBar1.Maximum = 100;
  25. }
  26. private void frmWaittingMsg_Load(object sender, EventArgs e)
  27. {
  28. //dataGridView1.Rows.Clear();
  29. progressBar1.Maximum = 100;
  30. this.Show();
  31. }
  32. /********************************************************/
  33. /* 화면이동 */
  34. /********************************************************/
  35. private void frmWaittingMsg_MouseDown(object sender, MouseEventArgs e)
  36. {
  37. try
  38. {
  39. if (WinMove)
  40. {
  41. mouseOffset = new Point(-e.X, -e.Y);
  42. }
  43. }
  44. catch (Exception ex)
  45. {
  46. Util.UErrorMessage(ex, 0, 0);
  47. }
  48. }
  49. private void frmWaittingMsg_MouseMove(object sender, MouseEventArgs e)
  50. {
  51. try
  52. {
  53. if (WinMove && (e.Button == MouseButtons.Left))
  54. {
  55. Point mousePos = Control.MousePosition;
  56. mousePos.Offset(mouseOffset.X, mouseOffset.Y);
  57. this.Location = mousePos;
  58. }
  59. }
  60. catch (Exception ex)
  61. {
  62. Util.UErrorMessage(ex, 0, 0);
  63. }
  64. }
  65. /********************************************************/
  66. // cyim 2016.12.28 : 예외처리 추가 : 팝업창의 리소스가 수신반의 경우 중복으로 다량으로 발생할수가 있으므로 크로스 스레드 방지 코드가 필요하다
  67. delegate void WaitingMsg_Callback(string msg, int processValue);
  68. public void setMessage(string message, int processValue)
  69. {
  70. if (this.InvokeRequired)
  71. {
  72. WaitingMsg_Callback d = new WaitingMsg_Callback(setMessage);
  73. this.Invoke(d, new object[] { message, processValue });
  74. }
  75. else
  76. {
  77. lblMessageTitle.Text = message;
  78. progressBar1.Value = processValue;
  79. this.Refresh();
  80. }
  81. }
  82. public void setParent(MDIParent parent)
  83. {
  84. this.parent = parent;
  85. }
  86. private void frmWaittingMsg_FormClosed(object sender, FormClosedEventArgs e)
  87. {
  88. try
  89. {
  90. if (this.parent != null)
  91. {
  92. this.parent.CloseWaittingMsgForm();
  93. }
  94. }
  95. catch (Exception ex)
  96. {
  97. Util.UErrorMessage(ex, 0, 0);
  98. }
  99. }
  100. }
  101. }