锐腾搅拌上料功能
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

202 lines
7.1 KiB

5 months ago
  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 DevExpress.XtraEditors;
  9. using ICSSoft.Base.Config.AppConfig;
  10. using ICSSoft.Base.Language.Tool;
  11. using ICSSoft.Base.UserControl.MessageControl;
  12. using ICSSoft.Base.Language.BLL;
  13. namespace ICSSoft.Frame.Main.Entrance
  14. {
  15. public partial class FormSysConfig : DevExpress.XtraEditors.XtraForm
  16. {
  17. LanguageBLL lanBll = new LanguageBLL();
  18. public FormSysConfig()
  19. {
  20. InitializeComponent();
  21. }
  22. private void btnSrvConfig_Click(object sender, EventArgs e)
  23. {
  24. FormConfigService fConfig = new FormConfigService(btnSrvConfig.Text);
  25. DialogResult diaLog = fConfig.ShowDialog();
  26. if (diaLog == DialogResult.OK || diaLog == DialogResult.Cancel)
  27. {
  28. try
  29. {
  30. object obj = AppConfig.InvokeWebservice(AppConfig.BaseServiceUri, "WebBaseService", "BaseService", "GetMainConnectString", new object[] { });
  31. if (obj != null)
  32. {
  33. bool flag = AppConfig.CheckDbConnectionState(AppConfig.FromMd5(obj.ToString()));
  34. if (flag == true)
  35. {
  36. AppConfig.FrameConnectString = AppConfig.FromMd5(obj.ToString());
  37. }
  38. else
  39. {
  40. AppConfig.FrameConnectString = "";
  41. }
  42. }
  43. else
  44. {
  45. AppConfig.FrameConnectString = "";
  46. }
  47. }
  48. catch
  49. {
  50. AppConfig.FrameConnectString = "";
  51. }
  52. }
  53. }
  54. private void btnClose_Click(object sender, EventArgs e)
  55. {
  56. this.DialogResult = DialogResult.Cancel;
  57. }
  58. #region 移动窗体
  59. private const int WM_NCHITTEST = 0x84;
  60. private const int HTCLIENT = 0x1;
  61. private const int HTCAPTION = 0x2;
  62. //首先必须了解Windows的消息传递机制,当有鼠标活动消息时,
  63. //系统发送WM_NCHITTEST 消息给窗体作为判断消息发生地的根据。 nchittest
  64. //假如你点击的是标题栏,窗体收到的消息值就是 HTCAPTION ,
  65. //同样地,若接受到的消息是 HTCLIENT,说明用户点击的是客户区,也就是鼠标消息发生在客户区。
  66. //重写窗体,使窗体可以不通过自带标题栏实现移动
  67. protected override void WndProc(ref Message m)
  68. {
  69. //当重载窗体的 WndProc 方法时,可以截获 WM_NCHITTEST 消息并改些该消息,
  70. //当判断鼠标事件发生在客户区时,改写改消息,发送 HTCAPTION 给窗体,
  71. //这样,窗体收到的消息就时 HTCAPTION ,在客户区通过鼠标来拖动窗体就如同通过标题栏来拖动一样。
  72. //注意:当你重载 WndProc 并改写鼠标事件后,整个窗体的鼠标事件也就随之改变了。
  73. switch (m.Msg)
  74. {
  75. case WM_NCHITTEST:
  76. base.WndProc(ref m);
  77. if ((int)m.Result == HTCLIENT)
  78. m.Result = (IntPtr)HTCAPTION;
  79. return;
  80. }
  81. //拦截双击标题栏、移动窗体的系统消息
  82. if (m.Msg != 0xA3)
  83. {
  84. base.WndProc(ref m);
  85. }
  86. }
  87. #endregion
  88. private void btnTestConn_Click(object sender, EventArgs e)
  89. {
  90. List<LangObj> langList = new List<LangObj>();
  91. if (AppConfig.BaseServiceUri == "")
  92. {
  93. LangObj langObj = new LangObj();
  94. langObj.LConvertString = "{0} 不可以为空{1}";
  95. langObj.LParameters = new object[] { "服务连接", "请设置服务!" };
  96. langList.Add(langObj);
  97. }
  98. if (langList.Count > 0)
  99. {
  100. MessageDialog messBox = new MessageDialog(1, langList);
  101. messBox.ShowDialog();
  102. return;
  103. }
  104. try
  105. {
  106. object obj = AppConfig.InvokeWebservice(AppConfig.BaseServiceUri, "WebBaseService", "BaseService", "GetMainConnectString", new object[] { });
  107. if (obj != null)
  108. {
  109. bool flag = AppConfig.CheckDbConnectionState(obj.ToString());
  110. if (flag == true)
  111. {
  112. LangObj langObj = new LangObj();
  113. langObj.LConvertString = "连接成功";
  114. langObj.LParameters = new object[] { };
  115. langList.Add(langObj);
  116. }
  117. else
  118. {
  119. LangObj langObj = new LangObj();
  120. langObj.LConvertString = "连接失败";
  121. langObj.LParameters = new object[] { };
  122. langList.Add(langObj);
  123. }
  124. }
  125. else
  126. {
  127. LangObj langObj = new LangObj();
  128. langObj.LConvertString = "获取连接值为空";
  129. langObj.LParameters = new object[] { };
  130. langList.Add(langObj);
  131. }
  132. }
  133. catch (Exception ex)
  134. {
  135. LangObj langObj = new LangObj();
  136. langObj.LConvertString = ex.Message;
  137. langObj.LParameters = new object[] { };
  138. langList.Add(langObj);
  139. }
  140. if (langList.Count > 0)
  141. {
  142. MessageDialog messBox = new MessageDialog(0, langList);
  143. messBox.ShowDialog();
  144. }
  145. }
  146. private void btnWorkPoint_Click(object sender, EventArgs e)
  147. {
  148. FormWorkPoint fw = new FormWorkPoint();
  149. fw.ShowDialog();
  150. }
  151. private void btnUpDateLang_Click(object sender, EventArgs e)
  152. {
  153. List<LangObj> langList = new List<LangObj>();
  154. try
  155. {
  156. lanBll.CreateLanguageXml(Application.StartupPath + "\\Language\\lang.xml");
  157. LangObj langObj = new LangObj();
  158. langObj.LConvertString = "更新成功!";
  159. langObj.LParameters = new object[] { };
  160. langList.Add(langObj);
  161. MessageDialog messBox = new MessageDialog(0, langList);
  162. messBox.ShowDialog();
  163. }
  164. catch (Exception ex)
  165. {
  166. LangObj langObj = new LangObj();
  167. langObj.LConvertString = ex.Message;
  168. langObj.LParameters = new object[] { };
  169. langList.Add(langObj);
  170. if (langList.Count > 0)
  171. {
  172. MessageDialog messBox = new MessageDialog(2, langList);
  173. messBox.ShowDialog();
  174. }
  175. }
  176. }
  177. }
  178. }