坐席客户端5.0

frmUpdateMsg.cs 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. using System.Runtime.InteropServices;
  9. using System.Diagnostics;
  10. namespace Lecall
  11. {
  12. public partial class frmUpdateMsg : Form
  13. {
  14. public frmUpdateMsg()
  15. {
  16. InitializeComponent();
  17. }
  18. /// <summary>
  19. /// 更新信息字符串
  20. /// </summary>
  21. public string Msg = "";
  22. #region 拖动无窗体控件
  23. [DllImport("user32.dll")]//*********************拖动无窗体的控件
  24. public static extern bool ReleaseCapture();
  25. [DllImport("user32.dll")]
  26. public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
  27. public const int WM_SYSCOMMAND = 0x0112;
  28. public const int SC_MOVE = 0xF010;
  29. public const int HTCAPTION = 0x0002;
  30. #endregion
  31. #region 拖拽窗体
  32. private void pnlTop_MouseDown(object sender, MouseEventArgs e)
  33. {
  34. ReleaseCapture();
  35. SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);//调用移动无窗体控件函数
  36. }
  37. #endregion
  38. /// <summary>
  39. /// 界面初始化
  40. /// </summary>
  41. /// <param name="sender"></param>
  42. /// <param name="e"></param>
  43. private void frmUpdateMsg_Load(object sender, EventArgs e)
  44. {
  45. SetMsg();
  46. }
  47. private void SetMsg()
  48. {
  49. string[] messageLines = Msg.Split('#');
  50. for (int i = 0; i < messageLines.Length; i++)
  51. {
  52. this.richtxtBoxMsg.AppendText(messageLines[i].ToString()+"\n");
  53. }
  54. }
  55. /// <summary>
  56. /// 关闭窗体
  57. /// </summary>
  58. /// <param name="sender"></param>
  59. /// <param name="e"></param>
  60. private void picClose_Click(object sender, EventArgs e)
  61. {
  62. this.Close();
  63. }
  64. /// <summary>
  65. /// 确定更新事件
  66. /// </summary>
  67. /// <param name="sender"></param>
  68. /// <param name="e"></param>
  69. private void btnSubmit_Click(object sender, EventArgs e)
  70. {
  71. Process p = new Process();
  72. p.StartInfo.FileName = Application.StartupPath + @"\Update.exe";
  73. p.Start();
  74. this.Close();
  75. }
  76. /// <summary>
  77. /// 取消更新
  78. /// </summary>
  79. /// <param name="sender"></param>
  80. /// <param name="e"></param>
  81. private void btnClose_Click(object sender, EventArgs e)
  82. {
  83. this.Close();
  84. }
  85. }
  86. }