星火微课系统客户端
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631
  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.Reflection;
  8. using System.Security.Principal;
  9. using System.Threading;
  10. using System.Windows;
  11. using System.Windows.Threading;
  12. using TStudyDigitalPen.HID;
  13. using XHWK.Model;
  14. using XHWK.WKTool.Helpers;
  15. namespace XHWK.WKTool
  16. {
  17. public partial class APP : Application
  18. {
  19. #region 全局变量
  20. /// <summary>
  21. /// 是否为测试版
  22. /// </summary>
  23. public static bool isDebug = FileToolsCommon.GetConfigValue("IsDebug") != "0";
  24. /// <summary>
  25. /// 是否输出测试记录日志
  26. /// </summary>
  27. public static bool IsOutputInfoLog = FileToolsCommon.GetConfigValue("IsOutputInfoLog") != "0";
  28. /// <summary>
  29. /// 是否隐藏录屏工具栏
  30. /// </summary>
  31. public static bool IsHideSRTool= FileToolsCommon.GetConfigValue("IsHideSRTool") != "0";
  32. /// <summary>
  33. /// 接口地址
  34. /// </summary>
  35. public static string apiUrl = isDebug ? "http://schoolapitest.xhkjedu.com" : FileToolsCommon.GetConfigValue("APIRequestAddress");
  36. /// <summary>
  37. /// 图片地址
  38. /// </summary>
  39. public static string uploadUrl = isDebug ? "http://schoolfiletest.xhkjedu.com/" : FileToolsCommon.GetConfigValue("FileRequestAddress");
  40. /// <summary>
  41. /// 展示文件
  42. /// </summary>
  43. public static string showImageUrl = isDebug ? "http://schoolfiletest.xhkjedu.com/static/" : FileToolsCommon.GetConfigValue("SchoolfileRequestAddress") + "/static/";
  44. /// <summary>
  45. /// 认证接口地址
  46. /// </summary>
  47. public static string certapiUrl = isDebug ? "http://certapitest.xhkjedu.com" : FileToolsCommon.GetConfigValue("CertapiRequestAddress");
  48. /// <summary>
  49. /// 数据存放目录
  50. /// </summary>
  51. public static string dataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\XHMicroLesson\\";
  52. /// <summary>
  53. /// 后台线程帮助类
  54. /// </summary>
  55. public static BackgroundWorkerHelper BackgroundWorkerHelper => BackgroundWorkerHelper.GetInstance();
  56. /// <summary>
  57. /// 签名
  58. /// </summary>
  59. public static string Signature = "";
  60. public static string secretKey = "nanhuakaizhangjianwangni";
  61. /// <summary>
  62. /// 用户信息
  63. /// </summary>
  64. public static Model_UserInfo UserInfo = null;
  65. /// <summary>
  66. /// 接口返回消息
  67. /// </summary>
  68. public static string ServerMsg = string.Empty;
  69. /// <summary>
  70. /// 用户微课列表模型
  71. /// </summary>
  72. public static List<Model_WKData> WKDataList = null;
  73. /// <summary>
  74. /// 微课模型
  75. /// </summary>
  76. public static Model_WKData WKData = null;
  77. /// <summary>
  78. /// 微课视频列表
  79. /// </summary>
  80. public static List<Model_Video> VideoList = null;
  81. /// <summary>
  82. /// 画板模型
  83. /// </summary>
  84. public static List<Model_DrawData> PageDrawList = null;
  85. /// <summary>
  86. /// 录屏工具
  87. /// </summary>
  88. public static FFMpeg FFmpeg = new FFMpeg();
  89. /// <summary>
  90. /// 登陆状态 false 未登录 true已登陆
  91. /// </summary>
  92. public static bool IsLoginType = false;
  93. public static readonly Model_Page pageData = new Model.Model_Page();
  94. /// <summary>
  95. /// 防止图片地址重复
  96. /// </summary>
  97. public static long num = 9999;
  98. /// <summary>
  99. /// 导入图片路径
  100. /// </summary>
  101. public static string[] Paths = new string[] { };
  102. /// <summary>
  103. /// 截图图片路径
  104. /// </summary>
  105. public static string[] JPaths = new string[999];
  106. public static string ImgPath = string.Empty;
  107. /// <summary>
  108. /// 页码IP
  109. /// </summary>
  110. public static string[] OutPut = new string[] { };
  111. public static string CameraPosition = string.Empty;
  112. /// <summary>
  113. /// 数据存放目录
  114. /// </summary>
  115. public static string DataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\XHMicroLesson\\";
  116. /// <summary>
  117. /// 教材列表
  118. /// </summary>
  119. public static List<Model_TsubjectbookList> TsubjectbookList = null;
  120. /// <summary>
  121. /// 章节列表
  122. /// </summary>
  123. public static List<Model_DirectorList> DirectorList = null;
  124. /// <summary>
  125. /// 上传个人空间 入参
  126. /// </summary>
  127. public static Model_ResourceAddTwo ResourceAddTwo = null;
  128. /// <summary>
  129. /// 是否正在
  130. /// </summary>
  131. public static bool IsUpLoad = false;
  132. #region 点阵笔
  133. /// <summary>
  134. /// 点阵笔
  135. /// </summary>
  136. public static DigitalPenHID digitalPen;
  137. /// <summary>
  138. /// 笔序号
  139. /// </summary>
  140. public static string PenSerial;
  141. /// <summary>
  142. /// 笔状态,是否已连接
  143. /// </summary>
  144. public static bool PenStatus;
  145. /// <summary>
  146. /// 手写板状态,是否已连接
  147. /// </summary>
  148. public static bool BoardStatus;
  149. #endregion
  150. #region 页面
  151. /// <summary>
  152. /// 主页面
  153. /// </summary>
  154. public static XHMicroLessonSystemWindow W_XHMicroLessonSystemWindow = null;
  155. /// <summary>
  156. /// 创建微课页面
  157. /// </summary>
  158. public static CreateAMicroLessonWindow W_CreateAMicroLessonWindow = null;
  159. /// <summary>
  160. /// 开始录像
  161. /// </summary>
  162. public static CountdownWindow W_CountdownWindow = null;
  163. /// <summary>
  164. /// 录像工具栏
  165. /// </summary>
  166. public static ScreenRecordingToolbarWindow W_ScreenRecordingToolbarWindow = null;
  167. /// <summary>
  168. /// 登陆
  169. /// </summary>
  170. public static LoginWindow W_LoginWindow = null;
  171. /// <summary>
  172. /// 截图
  173. /// </summary>
  174. public static JieTuWindow W_JieTuWindow = null;
  175. /// <summary>
  176. /// 批注
  177. /// </summary>
  178. public static PracticeWindow W_PracticeWindow = null;
  179. /// <summary>
  180. /// 我的视频
  181. /// </summary>
  182. public static FileDirectoryWindow fileDirectoryWindow = null;
  183. /// <summary>
  184. /// 打印
  185. /// </summary>
  186. public static PrintWindow W_PrintWindow = null;
  187. /// <summary>
  188. /// 提示窗口
  189. /// </summary>
  190. public static PromptWindow W_PromptWindow = null;
  191. /// <summary>
  192. /// loding页面
  193. /// </summary>
  194. public static LoadDialog myloading;
  195. /// <summary>
  196. /// 上传页面
  197. /// </summary>
  198. public static UploadWindow W_UploadWindow = null;
  199. /// <summary>
  200. /// 最小化工具栏
  201. /// </summary>
  202. public static MinToolbar W_MinToolbar = null;
  203. #endregion
  204. #endregion
  205. [STAThread]
  206. private static void Main()
  207. {
  208. myloading = new LoadDialog();
  209. StopSameProcess();
  210. Killffmpeg();
  211. LatticeFileHelper.RunPrintConfig();
  212. try
  213. {
  214. UserInfo = new Model_UserInfo();
  215. WKDataList = new List<Model_WKData>();
  216. VideoList = new List<Model_Video>();
  217. #region 强制以管理员方式运行 修改人:赵耀 修改时间:2020年9月7日
  218. WindowsIdentity identity = WindowsIdentity.GetCurrent();
  219. WindowsPrincipal principal = new WindowsPrincipal(identity);
  220. //判断当前登录用户是否为管理员
  221. //if (principal.IsInRole(WindowsBuiltInRole.Administrator))
  222. //{
  223. // //如果是管理员,则直接运行
  224. // W_CreateAMicroLessonWindow = new CreateAMicroLessonWindow();
  225. // // 定义Application对象作为整个应用程序入口
  226. // Application app = new Application();
  227. // app.Run(W_CreateAMicroLessonWindow);
  228. // //Application.Run(W_CreateAMicroLessonWindow);
  229. //}
  230. //else
  231. //{
  232. // //创建启动对象
  233. // System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo
  234. // {
  235. // UseShellExecute = true,
  236. // WorkingDirectory = Environment.CurrentDirectory,
  237. // FileName = Assembly.GetExecutingAssembly().Location,
  238. // //设置启动动作,确保以管理员身份运行
  239. // Verb = "runas"
  240. // };
  241. // try
  242. // {
  243. // System.Diagnostics.Process.Start(startInfo);
  244. // }
  245. // catch
  246. // {
  247. // return;
  248. // }
  249. // //退出
  250. // //Current.Shutdown();
  251. // Environment.Exit(0);
  252. //}
  253. #endregion
  254. try
  255. {
  256. if (Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + "temp"))//清除临时文件
  257. {
  258. Directory.Delete(AppDomain.CurrentDomain.BaseDirectory + "temp", true);
  259. }
  260. }
  261. catch (Exception)
  262. {
  263. }
  264. //如果本地文件为空,弹出弹窗 输密匙
  265. //本地文件不为空, 解析
  266. if (!File.Exists(APP.dataPath + "signature.txt"))//上次登陆时间为空 或者签名为空 或者上次登陆时间不是今天 都需要输入密匙验证 ,否则只验证本地的签名
  267. {
  268. if (principal.IsInRole(WindowsBuiltInRole.Administrator))
  269. {
  270. //如果是管理员,则直接运行
  271. KeyVerification wins = new KeyVerification();
  272. // 定义Application对象作为整个应用程序入口
  273. Application app = new Application();
  274. app.Run(wins);
  275. }
  276. else
  277. {
  278. //创建启动对象
  279. System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo
  280. {
  281. UseShellExecute = true,
  282. WorkingDirectory = Environment.CurrentDirectory,
  283. FileName = Assembly.GetExecutingAssembly().Location,
  284. //设置启动动作,确保以管理员身份运行
  285. Verb = "runas"
  286. };
  287. try
  288. {
  289. System.Diagnostics.Process.Start(startInfo);
  290. }
  291. catch
  292. {
  293. return;
  294. }
  295. //退出
  296. //Current.Shutdown();
  297. Environment.Exit(0);
  298. }
  299. }
  300. else
  301. {
  302. if (principal.IsInRole(WindowsBuiltInRole.Administrator))
  303. {
  304. ProductVerification wins = new ProductVerification();
  305. Application app = new Application();
  306. app.Run(wins);
  307. }
  308. else
  309. {
  310. //创建启动对象
  311. System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo
  312. {
  313. UseShellExecute = true,
  314. WorkingDirectory = Environment.CurrentDirectory,
  315. FileName = Assembly.GetExecutingAssembly().Location,
  316. //设置启动动作,确保以管理员身份运行
  317. Verb = "runas"
  318. };
  319. try
  320. {
  321. System.Diagnostics.Process.Start(startInfo);
  322. }
  323. catch
  324. {
  325. return;
  326. }
  327. //退出
  328. //Current.Shutdown();
  329. Environment.Exit(0);
  330. }
  331. }
  332. }
  333. catch (Exception ex)
  334. {
  335. string ErrMessage = "【进程】(Main):进程意外关闭。 " + ex.Message;
  336. LogHelper.WriteErrLog(ErrMessage, ex);
  337. }
  338. }
  339. #region 杀死已存在的进程
  340. /// <summary>
  341. /// 结束已运行的程序
  342. /// </summary>
  343. private static void StopSameProcess()
  344. {
  345. Process current = Process.GetCurrentProcess();
  346. Process[] processList = Process.GetProcesses();
  347. foreach (Process process in processList)
  348. {
  349. if (process.ProcessName.ToUpper() == "星火微课")
  350. {
  351. if (process.Id != current.Id) //忽略当前进程
  352. {
  353. try
  354. {
  355. process.Kill(); //结束进程
  356. }
  357. catch (Exception)
  358. {
  359. }
  360. }
  361. }
  362. }
  363. }
  364. /// <summary>
  365. /// 杀死正在运行的ffmpeg
  366. /// </summary>
  367. public static void Killffmpeg()
  368. {
  369. Process[] KillProcessArray = Process.GetProcessesByName("ffmpeg");
  370. foreach (Process KillProcess in KillProcessArray)
  371. {
  372. KillProcess.Kill();
  373. }
  374. }
  375. #endregion
  376. /// <summary>
  377. /// 错误处理
  378. /// </summary>
  379. /// <param name="sender"></param>
  380. /// <param name="e"></param>
  381. private void MyApp_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
  382. {
  383. LogHelper.WriteErrLog("未标示错误:" + e.Exception.Message, e.Exception);
  384. MessageWindow.Show("程序异常." + Environment.NewLine + e.Exception.Message);
  385. e.Handled = true;
  386. }
  387. #region 数据保存和读取
  388. /// <summary>
  389. /// 保存微课信息
  390. /// </summary>
  391. public static void SaveWkData()
  392. {
  393. try
  394. {
  395. WKData.VideoList = VideoList;
  396. if (WKDataList != null)
  397. {
  398. WKDataList.RemoveAll(x => x.WkPath == WKData.WkPath);
  399. }
  400. else
  401. {
  402. WKDataList = new List<Model_WKData>();
  403. }
  404. WKDataList.Add(WKData);
  405. //string WkDateXmlStr = XmlUtilHelper.Serializer(typeof(Model_WKData), WKData);
  406. string WkDateXmlStr = XmlUtilHelper.XmlSerialize(WKDataList);
  407. string SavePath = FileToolsCommon.GetFileAbsolutePath("/Data/");
  408. FileToolsCommon.CreateDirectory(SavePath);
  409. string SaveName = SavePath + "WkDate.d";
  410. FileToolsCommon.DeleteFile(SaveName);
  411. FileToolsCommon.WriteText(SaveName, WkDateXmlStr);
  412. }
  413. catch (Exception ex)
  414. {
  415. LogHelper.WriteErrLog("【微课数据保存】(SaveWkData)保存失败:" + ex.Message, ex);
  416. }
  417. }
  418. /// <summary>
  419. /// 读取微课信息
  420. /// </summary>
  421. public static void ReadWkData(string WkPath)
  422. {
  423. try
  424. {
  425. string SavePath = FileToolsCommon.GetFileAbsolutePath("/Data/");
  426. FileToolsCommon.CreateDirectory(SavePath);
  427. string SaveName = SavePath + "WkDate.d";
  428. //文件若存在则读取
  429. if (FileToolsCommon.IsExistFile(SaveName))
  430. {
  431. string WkDateXmlStr = FileToolsCommon.FileToString(SaveName);
  432. WKDataList = XmlUtilHelper.DESerializer<List<Model_WKData>>(WkDateXmlStr);
  433. foreach (Model_WKData wklist in WKDataList)
  434. {
  435. //移除找不到视频的微课数据
  436. wklist.VideoList.RemoveAll(x => !FileToolsCommon.IsExistFile(x.VideoPath));
  437. }
  438. if (WKDataList.Exists(x => x.WkPath == WkPath))
  439. {
  440. WKData = WKDataList.Find(x => x.WkPath == WkPath);
  441. VideoList = new List<Model_Video>();
  442. VideoList = WKData.VideoList;
  443. }
  444. }
  445. }
  446. catch (Exception ex)
  447. {
  448. LogHelper.WriteErrLog("【微课数据读取】(ReadWkData)读取失败:" + ex.Message, ex);
  449. }
  450. }
  451. /// <summary>
  452. /// 保存画板数据
  453. /// </summary>
  454. public static void SaveDraw()
  455. {
  456. try
  457. {
  458. if (PageDrawList == null)
  459. {
  460. return;
  461. }
  462. if (PageDrawList.Count < 1)
  463. {
  464. return;
  465. }
  466. FileToolsCommon.CreateDirectory(WKData.WkPath);
  467. string SavePath = WKData.WkPath + "PageData.d";
  468. FileToolsCommon.DeleteFile(SavePath);
  469. string PageDataXmlStr = XmlUtilHelper.XmlSerialize(PageDrawList);
  470. FileToolsCommon.WriteText(SavePath, PageDataXmlStr);
  471. }
  472. catch (Exception ex)
  473. {
  474. LogHelper.WriteErrLog("【画板数据保存】(SaveDraw)保存失败:" + ex.Message, ex);
  475. }
  476. }
  477. /// <summary>
  478. /// 读取文件
  479. /// </summary>
  480. public static void ReadDrawData()
  481. {
  482. try
  483. {
  484. PageDrawList = new List<Model_DrawData>();
  485. string SavePath = WKData.WkPath + "PageData.d";
  486. if (FileToolsCommon.IsExistFile(SavePath))
  487. {
  488. string PageDataXmlStr = FileToolsCommon.FileToString(SavePath);
  489. PageDrawList = XmlUtilHelper.DESerializer<List<Model_DrawData>>(PageDataXmlStr);
  490. }
  491. }
  492. catch (Exception ex)
  493. {
  494. LogHelper.WriteErrLog("【画板数据读取】(ReadDraw)读取失败:" + ex.Message, ex);
  495. }
  496. }
  497. #endregion
  498. #region 检测安装Screen Capturer Recorder
  499. /// <summary>
  500. /// 检测是否安装了Screen Capturer Recorder
  501. /// </summary>
  502. /// <returns></returns>
  503. public static bool CheckScreenCapturerRecorder()
  504. {
  505. if (FileToolsCommon.CheckSoftWartInstallState("Screen Capturer Recorder"))
  506. {
  507. //已经安装
  508. return true;
  509. }
  510. else
  511. {
  512. return false;
  513. }
  514. }
  515. /// <summary>
  516. /// 安装Screen Capturer Recorder
  517. /// </summary>
  518. /// <returns></returns>
  519. public static bool InstallScreenCapturerRecorder()
  520. {
  521. Process InstallProcess = new Process();
  522. string StandardError = "";
  523. string StandardOutput = "";
  524. try
  525. {
  526. InstallProcess.StartInfo.FileName = FileToolsCommon.GetFileAbsolutePath(@"/SSCR/Setup Screen Capturer Recorder v0.12.10.exe"); //绝对路径
  527. InstallProcess.StartInfo.UseShellExecute = false; //不使用操作系统外壳程序启动
  528. InstallProcess.StartInfo.RedirectStandardError = true; //重定向标准错误输出
  529. InstallProcess.StartInfo.RedirectStandardOutput = true;
  530. InstallProcess.StartInfo.CreateNoWindow = true; //不显示程序窗口
  531. InstallProcess.StartInfo.RedirectStandardInput = true; //用于模拟该进程控制台的输入
  532. //外部程序(这里是FFMPEG)输出流时候产生的事件,这里是把流的处理过程转移到下面的方法中,详细请查阅MSDN
  533. InstallProcess.ErrorDataReceived += new DataReceivedEventHandler(InstallProcess_ErrorDataReceived);
  534. InstallProcess.Start(); //启动线程
  535. InstallProcess.WaitForExit(); //阻塞等待进程结束
  536. StandardError = InstallProcess.StandardError.ReadToEnd();
  537. StandardOutput = InstallProcess.StandardOutput.ReadToEnd();
  538. int ExitCode = InstallProcess.ExitCode;
  539. InstallProcess.Close(); //关闭进程
  540. InstallProcess.Dispose(); //释放资源
  541. if (ExitCode == 0) //非0则为安装失败 1为取消安装
  542. {
  543. return true;
  544. }
  545. else
  546. {
  547. MessageBoxResult br = MessageWindow.Show("不安装环境将无法使用微课录制系统,是否现在安装?", "安装", MessageBoxButton.OKCancel);
  548. if (br == MessageBoxResult.OK)
  549. {
  550. return InstallScreenCapturerRecorder();
  551. }
  552. else
  553. {
  554. return false;
  555. }
  556. }
  557. }
  558. catch (Exception ex)
  559. {
  560. LogHelper.WriteErrLog("【ScreenCapturerRecorder安装】(installScreenCapturerRecorder)安装失败:" + ex.Message, ex);
  561. if (string.IsNullOrWhiteSpace(StandardError))
  562. {
  563. LogHelper.WriteErrLog("【ScreenCapturerRecorder安装】(installScreenCapturerRecorder)安装失败:" + StandardError, null);
  564. }
  565. if (string.IsNullOrWhiteSpace(StandardOutput))
  566. {
  567. LogHelper.WriteErrLog("【ScreenCapturerRecorder安装】(installScreenCapturerRecorder)安装返回信息:" + StandardOutput, null);
  568. }
  569. return false;
  570. }
  571. }
  572. /// <summary>
  573. /// 安装失败信息
  574. /// </summary>
  575. /// <param name="sender"></param>
  576. /// <param name="e"></param>
  577. private static void InstallProcess_ErrorDataReceived(object sender, DataReceivedEventArgs e)
  578. {
  579. LogHelper.WriteErrLog("【ScreenCapturerRecorder安装】(installScreenCapturerRecorder)安装失败:" + e.Data, null);
  580. //MessageWindow.Show(e.Data);
  581. }
  582. #endregion
  583. #region 内存处理 -创建人:赵耀 -创建时间:2020年8月12日
  584. /// <summary>
  585. /// 内存释放压缩
  586. /// </summary>
  587. /// <param name="e"></param>
  588. protected override void OnStartup(StartupEventArgs e)
  589. {
  590. //private LierdaCracker cracker = new LierdaCracker();
  591. //cracker.Cracker(5000);//间隔时间
  592. //base.OnStartup(e);
  593. new Thread(o =>
  594. {
  595. while (true)
  596. {
  597. try
  598. {
  599. //FreeMemoryHelper.SetDate();
  600. FreeMemoryHelper.ReallocateMemory();
  601. Thread.Sleep(20000);//暂定每20秒释放一次
  602. }
  603. catch (Exception ex)
  604. {
  605. LogHelper.WriteErrLog("【释放内存(MyApp)" + ex.Message, ex);
  606. }
  607. }
  608. }).Start();
  609. }
  610. #endregion 内存处理 -创建人:赵耀 -创建时间:2020年8月12日
  611. }
  612. }