星火微课系统客户端
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.

App.xaml.cs 23KB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711
  1. using ComeCapture;
  2. using Common.system;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Diagnostics;
  6. using System.IO;
  7. using System.Linq;
  8. using System.Reflection;
  9. using System.Security.Principal;
  10. using System.Threading.Tasks;
  11. using System.Windows;
  12. using XHWK.Model;
  13. using XHWK.WKTool.Helpers;
  14. using XHWK.WKTool.Skin;
  15. namespace XHWK.WKTool
  16. {
  17. using System.Runtime.InteropServices;
  18. using system;
  19. using XHWK.WKTool.Utils;
  20. public partial class App
  21. {
  22. #region 全局变量
  23. #region 更新需改动
  24. /// <summary>
  25. /// 是否为测试版
  26. /// </summary>
  27. public static bool isDebug = FileToolsCommon.GetConfigValue("IsDebug") != "0";
  28. #endregion 更新需改动
  29. #region 接口地址
  30. /// <summary>
  31. /// 是否为校外接口
  32. /// </summary>
  33. public static bool IsOutsideSchool = FileToolsCommon.GetConfigValue("IsOutsideSchool") == "1";
  34. /// <summary>
  35. /// 服务地址
  36. /// </summary>
  37. public static ModelServiceAddress ServiceAddress;
  38. /// <summary>
  39. /// 接口地址
  40. /// </summary>
  41. public static string apiUrl = isDebug ? "http://schoolapitest.xhkjedu.com" : "http://schoolapi.xhkjedu.com";
  42. /// <summary>
  43. /// 图片地址
  44. /// </summary>
  45. public static string uploadUrl = isDebug ? "http://schoolfiletest.xhkjedu.com/" : "http://schoolfile.xhkjedu.com/";
  46. /// <summary>
  47. /// 展示文件
  48. /// </summary>
  49. public static string showImageUrl = isDebug ? "http://schoolstatictest.xhkjedu.com/static/" : "http://schoolstatic.xhkjedu.com/static/";
  50. /// <summary>
  51. /// 认证接口地址
  52. /// </summary>
  53. public static string certapiUrl = isDebug ? "http://scapitest.xhkjedu.com" : "http://scapi.xhkjedu.com";
  54. #endregion 接口地址
  55. #region 配置项
  56. /// <summary>
  57. /// 是否输出测试记录日志
  58. /// </summary>
  59. public static bool IsOutputInfoLog = FileToolsCommon.GetConfigValue("IsOutputInfoLog") != "0";
  60. /// <summary>
  61. /// 是否隐藏录屏工具栏
  62. /// </summary>
  63. public static bool IsHideSRTool = FileToolsCommon.GetConfigValue("IsHideSRTool") != "0";
  64. /// <summary>
  65. /// 皮肤样式 0白 1蓝 2黑色
  66. /// </summary>
  67. public static string SkinStyle = FileToolsCommon.GetConfigValue("SkinStyle");
  68. /// <summary>
  69. /// 数据存放目录
  70. /// </summary>
  71. public static string DataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\XHMicroLesson\\";
  72. /// <summary>
  73. /// 摄像头位置
  74. /// </summary>
  75. public static string CameraPosition = string.Empty;
  76. /// <summary>
  77. /// 摄像头名
  78. /// </summary>
  79. public static string CameraName = "";
  80. /// <summary>
  81. /// 麦克风名
  82. /// </summary>
  83. public static string MicrophoneName = "";
  84. #endregion 配置项
  85. #region 记录数据
  86. /// <summary>
  87. /// 全局页面数据变量
  88. /// </summary>
  89. public static readonly ModelPage PageContextData = new Model.ModelPage();
  90. /// <summary>
  91. /// 录屏工具
  92. /// </summary>
  93. public static FFMpeg FFmpeg = new FFMpeg();
  94. /// <summary>
  95. /// 后台线程帮助类
  96. /// </summary>
  97. public static BackgroundWorkerHelper BackgroundWorkerHelper => BackgroundWorkerHelper.GetInstance();
  98. /// <summary>
  99. /// 签名
  100. /// </summary>
  101. public static string Signature = "";
  102. public static string secretKey = "nanhuakaizhangjianwangni";
  103. /// <summary>
  104. /// 用户信息
  105. /// </summary>
  106. public static ModelUserInfo UserInfo;
  107. /// <summary>
  108. /// 接口返回消息
  109. /// </summary>
  110. public static string ServerMsg = string.Empty;
  111. /// <summary>
  112. /// 登录状态 false 未登录 true已登录
  113. /// </summary>
  114. public static bool IsLoginType = false;
  115. /// <summary>
  116. /// 截图地址
  117. /// </summary>
  118. public static string ImgPath = string.Empty;
  119. /// <summary>
  120. /// 教材列表
  121. /// </summary>
  122. public static List<ModelTsubjectbookList> TsubjectbookList = null;
  123. /// <summary>
  124. /// 章节列表
  125. /// </summary>
  126. public static List<ModelDirectorList> DirectorList = null;
  127. /// <summary>
  128. /// 上传个人空间 入参
  129. /// </summary>
  130. public static ModelResourceAddTwo ResourceAddTwo = null;
  131. /// <summary>
  132. /// 是否正在上传
  133. /// </summary>
  134. public static bool IsUpLoad = false;
  135. #endregion 记录数据
  136. #region 微课数据记录
  137. /// <summary>
  138. /// 用户微课列表模型
  139. /// </summary>
  140. public static List<ModelWkData> WKDataList;
  141. /// <summary>
  142. /// 微课模型
  143. /// </summary>
  144. public static ModelWkData WKData;
  145. /// <summary>
  146. /// 微课视频列表
  147. /// </summary>
  148. public static List<ModelVideo> VideoList;
  149. /// <summary>
  150. /// 画板模型
  151. /// </summary>
  152. public static List<ModelDrawData> PageDrawList = new List<ModelDrawData>();
  153. #endregion 微课数据记录
  154. #region 点阵笔
  155. /// <summary>
  156. /// 笔序号
  157. /// </summary>
  158. public static string PenSerial;
  159. /// <summary>
  160. /// 笔状态,是否已连接
  161. /// </summary>
  162. public static bool PenStatus = false;
  163. /// <summary>
  164. /// 手写板状态,是否已连接
  165. /// </summary>
  166. public static bool BoardStatus = false;
  167. #endregion 点阵笔
  168. #region 腾千里手写笔
  169. ///// <summary>
  170. ///// 铺码服务请求
  171. ///// </summary>
  172. //public static DAL_TmatrixCode dAL_TmatrixCode;
  173. /// <summary>
  174. /// 腾千里手写笔事件
  175. /// </summary>
  176. public static PenEvents TQLPenevents;
  177. /// <summary>
  178. /// 腾千里手写笔是否已连接
  179. /// </summary>
  180. public static bool TQLPenStatus = false;
  181. #region 打印
  182. public static bool gbGenerateBGWithVImage = false;
  183. public static bool gbGenerateVImage = false;
  184. public static bool gbGenerateBGWithoutVImage = false;
  185. public static bool gbGenerateBGWithImage = false;
  186. public static bool gbGenPageSet = false;
  187. public static int[] gPointType = new int[5];
  188. public static int[] gPointDPI = new int[5];
  189. public static string gTMXElementFileName;
  190. public static string gNewProjectDirectory;
  191. public static bool gbElementFileExist { get; set; }
  192. #endregion 打印
  193. #endregion 腾千里手写笔
  194. #region 页面
  195. /// <summary>
  196. /// 主页面
  197. /// </summary>
  198. public static MainWindow W_XHMicroLessonSystemWindow = null;
  199. /// <summary>
  200. /// 倒计时窗口
  201. /// </summary>
  202. public static CountdownWindow W_CountdownWindow = null;
  203. /// <summary>
  204. /// 录像工具栏
  205. /// </summary>
  206. public static ScreenRecordingToolbarWindow W_ScreenRecordingToolbarWindow = null;
  207. /// <summary>
  208. /// 登录
  209. /// </summary>
  210. public static LoginWindow W_LoginWindow = null;
  211. /// <summary>
  212. /// 截图
  213. /// </summary>
  214. public static JieTuWindow W_JieTuWindow = null;
  215. /// <summary>
  216. /// 批注
  217. /// </summary>
  218. public static PracticeWindow W_PracticeWindow = null;
  219. /// <summary>
  220. /// 提示窗口
  221. /// </summary>
  222. public static PromptWindow W_PromptWindow = null;
  223. /// <summary>
  224. /// loding页面
  225. /// </summary>
  226. public static LoadDialog myloading;
  227. /// <summary>
  228. /// 上传页面
  229. /// </summary>
  230. public static UploadWindow W_UploadWindow = null;
  231. /// <summary>
  232. /// 最小化工具栏
  233. /// </summary>
  234. public static MinToolbar W_MinToolbar = null;
  235. /// <summary>
  236. /// 视频剪辑
  237. /// </summary>
  238. public static VideoClipWindow W_VideoClipWindow = null;
  239. #endregion 页面
  240. #endregion 全局变量
  241. public App()
  242. {
  243. Console.WriteLine(@"初始化APP");
  244. LogHelper.InitLog4Net();
  245. ZHttpUtil.isSt = ZConfigAppUtil.GetVaule("isSt") == "True";
  246. ZHttpUtil.version = FileToolsCommon.GetConfigValue("VersionName");
  247. myloading = new LoadDialog();
  248. Killffmpeg();
  249. try
  250. {
  251. UserInfo = new ModelUserInfo();
  252. WKDataList = new List<ModelWkData>();
  253. VideoList = new List<ModelVideo>();
  254. #region 强制以管理员方式运行 修改人:赵耀 修改时间:2020年9月7日
  255. WindowsIdentity identity = WindowsIdentity.GetCurrent();
  256. WindowsPrincipal principal = new WindowsPrincipal(identity);
  257. #endregion 强制以管理员方式运行 修改人:赵耀 修改时间:2020年9月7日
  258. try
  259. {
  260. if (Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + "Temp")) //清除临时文件
  261. {
  262. Directory.Delete(AppDomain.CurrentDomain.BaseDirectory + "Temp", true);
  263. }
  264. }
  265. catch (Exception)
  266. {
  267. // ignored
  268. }
  269. if (principal.IsInRole(WindowsBuiltInRole.Administrator))
  270. {
  271. SkinConfig.InitSkin();
  272. }
  273. else
  274. {
  275. //创建启动对象
  276. System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo
  277. {
  278. UseShellExecute = true,
  279. WorkingDirectory = Environment.CurrentDirectory,
  280. FileName = Assembly.GetExecutingAssembly().Location,
  281. //设置启动动作,确保以管理员身份运行
  282. Verb = "runas"
  283. };
  284. try
  285. {
  286. System.Diagnostics.Process.Start(startInfo);
  287. }
  288. catch
  289. {
  290. return;
  291. }
  292. //退出
  293. //Current.Shutdown();
  294. Current.Shutdown();
  295. }
  296. }
  297. catch (Exception ex)
  298. {
  299. string errMessage = "【进程】(Main):进程意外关闭。 " + ex.Message;
  300. LogHelper.Logerror.Error(errMessage, ex);
  301. }
  302. }
  303. #region 杀死已存在的进程
  304. [DllImport("User32.dll")]
  305. private static extern int FindWindow(string className, string windowName);
  306. [DllImport("user32.dll")]
  307. public static extern bool SetForegroundWindow(int hWnd);
  308. private static void CheckProcess()
  309. {
  310. Console.WriteLine(@"程序启动");
  311. Process current = Process.GetCurrentProcess();
  312. //获取欲启动进程名
  313. string strProcessName = Process.GetCurrentProcess().ProcessName;
  314. Process[] processList = Process.GetProcessesByName(strProcessName);
  315. if (processList.Length <= 1)
  316. {
  317. return;
  318. }
  319. MessageWindow.Show("当前程序已在运行,请勿重复运行。");
  320. foreach (Process process in processList)
  321. {
  322. if (process.Id == current.Id) continue;
  323. int hWnd = FindWindow(null, process.MainWindowTitle);
  324. SetForegroundWindow(hWnd);
  325. }
  326. Current.Shutdown(); //退出新打开的程序
  327. }
  328. /// <summary>
  329. /// 杀死正在运行的ffmpeg
  330. /// </summary>
  331. public static void Killffmpeg()
  332. {
  333. Process[] killProcessArray = Process.GetProcessesByName("ffmpeg");
  334. foreach (Process killProcess in killProcessArray)
  335. {
  336. killProcess.Kill();
  337. }
  338. }
  339. #endregion 杀死已存在的进程
  340. private void RegisterEvents()
  341. {
  342. //Task线程内未捕获异常处理事件
  343. TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException; //Task异常
  344. //UI线程未捕获异常处理事件(UI主线程)
  345. DispatcherUnhandledException += App_DispatcherUnhandledException;
  346. //非UI线程未捕获异常处理事件(例如自己创建的一个子线程)
  347. AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
  348. }
  349. private static void TaskScheduler_UnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
  350. {
  351. try
  352. {
  353. if (e.Exception is Exception exception)
  354. {
  355. HandleException(exception);
  356. }
  357. }
  358. catch (Exception ex)
  359. {
  360. HandleException(ex);
  361. }
  362. finally
  363. {
  364. e.SetObserved();
  365. }
  366. }
  367. //非UI线程未捕获异常处理事件(例如自己创建的一个子线程)
  368. private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
  369. {
  370. try
  371. {
  372. if (e.ExceptionObject is Exception exception)
  373. {
  374. HandleException(exception);
  375. }
  376. }
  377. catch (Exception ex)
  378. {
  379. HandleException(ex);
  380. }
  381. }
  382. //UI线程未捕获异常处理事件(UI主线程)
  383. private static void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
  384. {
  385. try
  386. {
  387. HandleException(e.Exception);
  388. }
  389. catch (Exception ex)
  390. {
  391. HandleException(ex);
  392. }
  393. finally
  394. {
  395. e.Handled = true;
  396. }
  397. }
  398. private static void HandleException(Exception ex)
  399. {
  400. //记录日志
  401. LogHelper.Logerror.Error("未捕获异常:" + ex.Message, ex);
  402. Current.Shutdown();
  403. }
  404. #region 数据保存和读取
  405. /// <summary>
  406. /// 保存微课信息
  407. /// </summary>
  408. public static void SaveWkData()
  409. {
  410. try
  411. {
  412. VideoList = VideoList.Where((x, i) => VideoList.FindIndex(z => z.FileGuid == x.FileGuid) == i).ToList();
  413. WKData.VideoList = VideoList;
  414. if (WKDataList != null)
  415. {
  416. WKDataList.RemoveAll(x => x.WkPath == WKData.WkPath);
  417. }
  418. else
  419. {
  420. WKDataList = new List<ModelWkData>();
  421. }
  422. WKDataList.Add(WKData);
  423. string wkDateXmlStr = XmlUtilHelper.XmlSerialize(WKDataList);
  424. string savePath = FileToolsCommon.GetFileAbsolutePath("/Data/");
  425. FileToolsCommon.CreateDirectory(savePath);
  426. string saveName = savePath + "WkDate.xml";
  427. FileToolsCommon.DeleteFile(saveName);
  428. FileToolsCommon.WriteText(saveName, wkDateXmlStr);
  429. }
  430. catch (Exception ex)
  431. {
  432. LogHelper.Logerror.Error("【微课数据保存】(SaveWkData)保存失败:" + ex.Message, ex);
  433. }
  434. }
  435. /// <summary>
  436. /// 读取微课信息
  437. /// </summary>
  438. public static void ReadWkData(string wkPath)
  439. {
  440. try
  441. {
  442. string savePath = FileToolsCommon.GetFileAbsolutePath("/Data/");
  443. FileToolsCommon.CreateDirectory(savePath);
  444. string saveName = savePath + "WkDate.xml";
  445. //文件若存在则读取
  446. if (FileToolsCommon.IsExistFile(saveName))
  447. {
  448. string wkDateXmlStr = FileToolsCommon.FileToString(saveName);
  449. WKDataList = XmlUtilHelper.DeSerializer<List<ModelWkData>>(wkDateXmlStr);
  450. foreach (ModelWkData wklist in WKDataList)
  451. {
  452. //移除找不到视频的微课数据
  453. wklist.VideoList.RemoveAll(x => !FileToolsCommon.IsExistFile(x.VideoPath));
  454. }
  455. if (WKDataList.Exists(x => x.WkPath == wkPath))
  456. {
  457. WKData = WKDataList.Find(x => x.WkPath == wkPath);
  458. VideoList = new List<ModelVideo>();
  459. WKData.VideoList = WKData.VideoList.Where((x, i) => WKData.VideoList.FindIndex(z => z.FileGuid == x.FileGuid) == i).ToList();
  460. VideoList = WKData.VideoList;
  461. }
  462. }
  463. }
  464. catch (Exception ex)
  465. {
  466. LogHelper.Logerror.Error("【微课数据读取】(ReadWkData)读取失败:" + ex.Message, ex);
  467. }
  468. }
  469. /// <summary>
  470. /// 保存画板数据
  471. /// </summary>
  472. public static void SaveDraw()
  473. {
  474. try
  475. {
  476. if (PageDrawList == null)
  477. {
  478. return;
  479. }
  480. if (PageDrawList.Count < 1)
  481. {
  482. return;
  483. }
  484. FileToolsCommon.CreateDirectory(WKData.WkPath);
  485. string savePath = WKData.WkPath + "PageData.xml";
  486. FileToolsCommon.DeleteFile(savePath);
  487. string pageDataXmlStr = XmlUtilHelper.XmlSerialize(PageDrawList);
  488. FileToolsCommon.WriteText(savePath, pageDataXmlStr);
  489. }
  490. catch (Exception ex)
  491. {
  492. LogHelper.Logerror.Error("【画板数据保存】(SaveDraw)保存失败:" + ex.Message, ex);
  493. }
  494. }
  495. /// <summary>
  496. /// 读取文件
  497. /// </summary>
  498. public static void ReadDrawData()
  499. {
  500. try
  501. {
  502. PageDrawList = new List<ModelDrawData>();
  503. string savePath = WKData.WkPath + "PageData.xml";
  504. if (FileToolsCommon.IsExistFile(savePath))
  505. {
  506. string pageDataXmlStr = FileToolsCommon.FileToString(savePath);
  507. PageDrawList = XmlUtilHelper.DeSerializer<List<ModelDrawData>>(pageDataXmlStr);
  508. }
  509. else
  510. {
  511. PageDrawList = new List<ModelDrawData>();
  512. }
  513. }
  514. catch (Exception ex)
  515. {
  516. LogHelper.Logerror.Error("【画板数据读取】(ReadDraw)读取失败:" + ex.Message, ex);
  517. }
  518. }
  519. #endregion 数据保存和读取
  520. #region 服务地址数据
  521. /// <summary>
  522. /// 服务地址存储到本地
  523. /// </summary>
  524. public static void SaveServiceAddressData()
  525. {
  526. try
  527. {
  528. if (ServiceAddress == null)
  529. {
  530. return;
  531. }
  532. string dateXmlStr = XmlUtilHelper.XmlSerialize(ServiceAddress);
  533. string savePath = DataPath;
  534. FileToolsCommon.CreateDirectory(savePath);
  535. string saveName = savePath + (isDebug ? "ServiceAddressDebug.xml" : "ServiceAddressRelease.xml");
  536. Console.WriteLine(@"保存路径为:");
  537. FileToolsCommon.DeleteFile(saveName);
  538. FileToolsCommon.WriteText(saveName, dateXmlStr);
  539. }
  540. catch (Exception ex)
  541. {
  542. LogHelper.Logerror.Error("【服务地址存储】(SaveServiceAddressData)保存失败:" + ex.Message, ex);
  543. }
  544. }
  545. /// <summary>
  546. /// 从本地读取服务地址
  547. /// </summary>
  548. public static void ReadServiceAddressData()
  549. {
  550. try
  551. {
  552. string savePath = DataPath;
  553. FileToolsCommon.CreateDirectory(savePath);
  554. string saveName = savePath + (isDebug ? "ServiceAddressDebug.xml" : "ServiceAddressRelease.xml");
  555. Console.WriteLine(@"配置文件路径" + saveName);
  556. //文件若存在则读取
  557. if (FileToolsCommon.IsExistFile(saveName))
  558. {
  559. string dateXmlStr = FileToolsCommon.FileToString(saveName);
  560. ServiceAddress = XmlUtilHelper.DeSerializer<ModelServiceAddress>(dateXmlStr);
  561. SwitchAddress();
  562. }
  563. }
  564. catch (Exception ex)
  565. {
  566. LogHelper.Logerror.Error("【服务地址读取】(ReadServiceAddressData)读取失败:" + ex.Message, ex);
  567. }
  568. }
  569. /// <summary>
  570. /// 切换校内外网
  571. /// </summary>
  572. public static void SwitchAddress()
  573. {
  574. try
  575. {
  576. apiUrl = IsOutsideSchool ? ServiceAddress.wapi : ServiceAddress.napi;
  577. uploadUrl = (IsOutsideSchool ? ServiceAddress.wfile : ServiceAddress.nfile) + "/";
  578. showImageUrl = (IsOutsideSchool ? ServiceAddress.wdown : ServiceAddress.ndown) + "/static/";
  579. }
  580. catch (Exception ex)
  581. {
  582. LogHelper.Logerror.Error("【服务地址切换】(SwitchAddress)服务复制切换失败,请求地址为空!", ex);
  583. }
  584. }
  585. #endregion 服务地址数据
  586. /// <summary>
  587. /// 内存释放压缩
  588. /// </summary>
  589. /// <param name="e">
  590. /// </param>
  591. protected override void OnStartup(StartupEventArgs e)
  592. {
  593. RegisterEvents();
  594. base.OnStartup(e);
  595. CheckProcess();
  596. }
  597. protected override void OnExit(ExitEventArgs e)
  598. {
  599. // 在应用程序退出之前执行必要的操作
  600. ZConfigAppUtil.SetVaule("isSt", "" + ZHttpUtil.isSt);
  601. Console.WriteLine(@"应用退出");
  602. base.OnExit(e);
  603. Environment.Exit(0);
  604. }
  605. }
  606. }