终端一体化运控平台
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 

393 rindas
23 KiB

  1. using BPA.Communication;
  2. using BPA.Helper;
  3. using BPA.Message;
  4. using BPA.Message.Enum;
  5. using Newtonsoft.Json;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading;
  11. using System.Threading.Tasks;
  12. using System.Windows;
  13. using System.Windows.Controls;
  14. using System.Windows.Data;
  15. using System.Windows.Documents;
  16. using System.Windows.Input;
  17. using System.Windows.Media;
  18. using System.Windows.Media.Imaging;
  19. using System.Windows.Navigation;
  20. using System.Windows.Shapes;
  21. namespace WpfTest
  22. {
  23. /// <summary>
  24. /// Interaction logic for MainWindow.xaml
  25. /// </summary>
  26. public partial class MainWindow : Window
  27. {
  28. /// <summary>
  29. /// MQTT连接信息
  30. /// </summary>
  31. public string MQTTConnection { get; set; } = "171.221.208.23,11883,admin,public1";
  32. /// <summary>
  33. /// Mqtt是否运行
  34. /// </summary>
  35. public bool IsRunningMqtt = false;
  36. /// <summary>
  37. /// Mqtt
  38. /// </summary>
  39. public MqttHelper mqttHelper = new MqttHelper();
  40. public MainWindow()
  41. {
  42. InitializeComponent();
  43. Connection();
  44. ThreadServer();
  45. //Button_Click(null, null);
  46. }
  47. public void ThreadServer()
  48. {
  49. TaskManage.GetInstance.StartLong(new Action(() =>
  50. {
  51. try
  52. {
  53. if (IsRunningMqtt)
  54. {
  55. Send(ScreenDeviceType.大炒);
  56. Send(ScreenDeviceType.小炒); Thread.Sleep(1000);
  57. Send(ScreenDeviceType.煮面机); Thread.Sleep(1000);
  58. Send(ScreenDeviceType.分餐机); Thread.Sleep(1000);
  59. Thread.Sleep(3000);
  60. }
  61. }
  62. catch (Exception ex)
  63. {
  64. MessageLog.GetInstance.ShowEx($"{Name}:线程服务异常,原因:{ex.Message}");
  65. }
  66. Thread.Sleep(100);
  67. }), $"{Name},线程服务");
  68. }
  69. /// <summary>
  70. /// 初始化连接Redis MQTT
  71. /// </summary>
  72. public void Connection()
  73. {
  74. try
  75. {
  76. //2.Mqtt连接
  77. if (!string.IsNullOrEmpty(this.MQTTConnection) && this.MQTTConnection.Contains(','))
  78. {
  79. string[] mqttcom = this.MQTTConnection.Split(',');
  80. if (mqttcom != null && mqttcom.Count() == 4)
  81. {
  82. mqttHelper.Connect(mqttcom[2], mqttcom[3], mqttcom[0], int.Parse(mqttcom[1]), $"{Name}:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
  83. }
  84. }
  85. mqttHelper.Disconnect = new Action(() =>
  86. {
  87. IsRunningMqtt = false;
  88. MessageLog.GetInstance.ShowEx($"{Name}:MQTT异常断开....");
  89. });
  90. mqttHelper.ConnectOk = new Action(() =>
  91. {
  92. IsRunningMqtt = true;//连接成功
  93. });
  94. }
  95. catch (Exception ex)
  96. {
  97. MessageLog.GetInstance.ShowEx($"{Name}:初始化连接 MQTT,原因:{ex.Message}");
  98. }
  99. }
  100. public void Send(ScreenDeviceType screen)
  101. {
  102. int k2 =new Random().Next(0, 2);
  103. SendScreenDataModel sendScreenData = new SendScreenDataModel();
  104. List<ORDER_STATUS> oRDER_STATUS = new List<ORDER_STATUS>() { ORDER_STATUS.WAIT, ORDER_STATUS.COOKING, ORDER_STATUS.COMPLETED_COOK, ORDER_STATUS.COMPLETED_TAKE, ORDER_STATUS.ERR_NOT_REPLY_WHEN_COOKING };
  105. List<string> name_s = new List<string>() { "回锅肉", "烂肉豇豆", "火爆腰花", "尖椒鸡杂", "回锅肉" };
  106. List<string> name_s_zm = new List<string>() { "清汤面", "鸡蛋面", "火鸡面", "回锅肉面", "鸡杂面" };
  107. List<string> name_XM = new List<string>() { "王权贵", "张哲", "李青古", "龙西", "李富贵" };
  108. int k = new Random().Next(0, 5);
  109. int M = new Random().Next(0, 5);
  110. if (screen == ScreenDeviceType.大炒)
  111. {
  112. sendScreenData.Name = screen;
  113. sendScreenData.Value = new ScreenModelMaxWok
  114. {
  115. IsRun = k2 == 0 ? IsRun.运行 : IsRun.停止,
  116. WorkStatus_1 = k2 == 0 ? WorkStatus.工作 : WorkStatus.待机,
  117. WorkStatus_2 = k2 == 0 ? WorkStatus.工作 : WorkStatus.待机,
  118. RobotStatu = k2 == 0 ? WorkStatus.工作 : WorkStatus.待机,
  119. // Alarm = new List<AlarmModel> {
  120. // new AlarmModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" },
  121. // new AlarmModel { AlarmTime = DateTime.Now.AddSeconds(1).ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" },
  122. // new AlarmModel { AlarmTime = DateTime.Now.AddSeconds(2).ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" },
  123. //},
  124. FailuresCount = 0,
  125. StatsCount = new List<StatsModel> {
  126. new StatsModel{Name= name_s[0],Count=new Random().Next(0, 100)},
  127. new StatsModel{Name= name_s[1],Count=new Random().Next(0, 100)},
  128. new StatsModel{Name= name_s[2],Count=new Random().Next(0, 100)},
  129. new StatsModel{Name= name_s[3],Count=new Random().Next(0, 100)},
  130. new StatsModel{Name= name_s[4],Count=new Random().Next(0, 100)},
  131. },
  132. MaxWok_Dishes_1 = "回锅肉",
  133. MaxWok_Task_1 = "炒菜中",
  134. MaxWok_Process_1 = new List<ProcessModel> {
  135. new ProcessModel{ Id=0,Name= "清洗", Status=(M==0) ? ProcessStatus.正在执行:((M>0)?ProcessStatus.执行完成:ProcessStatus.未执行)},
  136. new ProcessModel{ Id=1,Name= "到菜", Status=(M==1) ? ProcessStatus.正在执行:((M>1)?ProcessStatus.执行完成:ProcessStatus.未执行)},
  137. new ProcessModel{ Id=2,Name= "翻炒", Status=(M==2) ? ProcessStatus.正在执行:((M>2)?ProcessStatus.执行完成:ProcessStatus.未执行)},
  138. new ProcessModel{ Id=3,Name= "调料", Status=(M==3) ? ProcessStatus.正在执行:((M>3)?ProcessStatus.执行完成:ProcessStatus.未执行)},
  139. new ProcessModel{ Id=4,Name= "完成", Status=(M==4) ? ProcessStatus.正在执行:((M>4)?ProcessStatus.执行完成:ProcessStatus.未执行)},
  140. },
  141. MaxWok_HeatGear_1 = "1",
  142. MaxWok_StirGear_1 = "2",
  143. MaxWok_FlipSpeed_1 = "30",
  144. MaxWok_Temp_1 = "102",
  145. MaxWok_OrderCount_1 = new Random().Next(0, 100),
  146. MaxWok_ErrorOrderCount_1 = new Random().Next(0, 100),
  147. MaxWok_Dishes_2 = "烂肉豇豆",
  148. MaxWok_Task_2 = "炒菜中",
  149. MaxWok_Process_2 = new List<ProcessModel> {
  150. new ProcessModel{ Id=0,Name= "清洗", Status=(k==0) ? ProcessStatus.正在执行:((k>0)?ProcessStatus.执行完成:ProcessStatus.未执行)},
  151. new ProcessModel{ Id=1,Name= "到菜", Status=(k==1) ? ProcessStatus.正在执行:((k>1)?ProcessStatus.执行完成:ProcessStatus.未执行)},
  152. new ProcessModel{ Id=2,Name= "翻炒", Status=(k==2) ? ProcessStatus.正在执行:((k>2)?ProcessStatus.执行完成:ProcessStatus.未执行)},
  153. new ProcessModel{ Id=3,Name= "调料", Status=(k==3) ? ProcessStatus.正在执行:((k>3)?ProcessStatus.执行完成:ProcessStatus.未执行)},
  154. new ProcessModel{ Id=4,Name= "完成", Status=(k==4) ? ProcessStatus.正在执行:((k>4)?ProcessStatus.执行完成:ProcessStatus.未执行)},
  155. },
  156. MaxWok_HeatGear_2 = "2",
  157. MaxWok_StirGear_2 = "3",
  158. MaxWok_FlipSpeed_2 = "32",
  159. MaxWok_Temp_2 = "132",
  160. MaxWok_OrderCount_2 = new Random().Next(0, 100),
  161. MaxWok_ErrorOrderCount_2 = new Random().Next(0, 100),
  162. };
  163. }
  164. else if (screen == ScreenDeviceType.小炒)
  165. {
  166. sendScreenData.Name = screen;
  167. sendScreenData.Value = new ScreenModelMinWok
  168. {
  169. IsRun = k2 == 0 ? IsRun.运行 : IsRun.停止,
  170. WorkStatus_1 = k2 == 0 ? WorkStatus.工作 : WorkStatus.待机,
  171. WorkStatus_2 = k2 == 0 ? WorkStatus.工作 : WorkStatus.待机,
  172. RobotStatu = k2 == 0 ? WorkStatus.工作 : WorkStatus.待机,
  173. // Alarm = new List<AlarmModel> {
  174. // new AlarmModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" },
  175. // new AlarmModel { AlarmTime = DateTime.Now.AddSeconds(1).ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" },
  176. // new AlarmModel { AlarmTime = DateTime.Now.AddSeconds(2).ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" },
  177. //},
  178. FailuresCount = 0,
  179. StatsCount = new List<StatsModel> {
  180. new StatsModel{Name= name_s[0],Count=new Random().Next(0, 100)},
  181. new StatsModel{Name= name_s[1],Count=new Random().Next(0, 100)},
  182. new StatsModel{Name= name_s[2],Count=new Random().Next(0, 100)},
  183. new StatsModel{Name= name_s[3],Count=new Random().Next(0, 100)},
  184. new StatsModel{Name= name_s[4],Count=new Random().Next(0, 100)},
  185. },
  186. MinWok_Dishes_1 = "回锅肉",
  187. MinWok_Task_1 = "炒菜中",
  188. MinWok_Process_1 = new List<ProcessModel> {
  189. new ProcessModel{ Id=0,Name= "清洗", Status=(M==0) ? ProcessStatus.正在执行:((M>0)?ProcessStatus.执行完成:ProcessStatus.未执行)},
  190. new ProcessModel{ Id=1,Name= "到菜", Status=(M==1) ? ProcessStatus.正在执行:((M>1)?ProcessStatus.执行完成:ProcessStatus.未执行)},
  191. new ProcessModel{ Id=2,Name= "翻炒", Status=(M==2) ? ProcessStatus.正在执行:((M>2)?ProcessStatus.执行完成:ProcessStatus.未执行)},
  192. new ProcessModel{ Id=3,Name= "调料", Status=(M==3) ? ProcessStatus.正在执行:((M>3)?ProcessStatus.执行完成:ProcessStatus.未执行)},
  193. new ProcessModel{ Id=4,Name= "完成", Status=(M==4) ? ProcessStatus.正在执行:((M>4)?ProcessStatus.执行完成:ProcessStatus.未执行)},
  194. },
  195. MinWok_HeatGear_1 = "1",
  196. MinWok_StirGear_1 = "2",
  197. MinWok_FlipSpeed_1 = "30",
  198. MinWok_Temp_1 = "102",
  199. MinWok_OrderCount_1 = new Random().Next(0, 100),
  200. MinWok_ErrorOrderCount_1 = new Random().Next(0, 100),
  201. MinWok_Dishes_2 = "烂肉豇豆",
  202. MinWok_Task_2 = "炒菜中",
  203. MinWok_Process_2 = new List<ProcessModel> {
  204. new ProcessModel{ Id=0,Name= "清洗", Status=(k==0) ? ProcessStatus.正在执行:((k>0)?ProcessStatus.执行完成:ProcessStatus.未执行)},
  205. new ProcessModel{ Id=1,Name= "到菜", Status=(k==1) ? ProcessStatus.正在执行:((k>1)?ProcessStatus.执行完成:ProcessStatus.未执行)},
  206. new ProcessModel{ Id=2,Name= "翻炒", Status=(k==2) ? ProcessStatus.正在执行:((k>2)?ProcessStatus.执行完成:ProcessStatus.未执行)},
  207. new ProcessModel{ Id=3,Name= "调料", Status=(k==3) ? ProcessStatus.正在执行:((k>3)?ProcessStatus.执行完成:ProcessStatus.未执行)},
  208. new ProcessModel{ Id=4,Name= "完成", Status=(k==4) ? ProcessStatus.正在执行:((k>4)?ProcessStatus.执行完成:ProcessStatus.未执行)},
  209. },
  210. MinWok_HeatGear_2 = "2",
  211. MinWok_StirGear_2 = "3",
  212. MinWok_FlipSpeed_2 = "32",
  213. MinWok_Temp_2 = "132",
  214. MinWok_OrderCount_2 = new Random().Next(0, 100),
  215. MinWok_ErrorOrderCount_2 = new Random().Next(0, 100),
  216. };
  217. }
  218. else if (screen == ScreenDeviceType.煮面机)
  219. {
  220. sendScreenData.Name = screen;
  221. sendScreenData.Value = new ScreenModelMorkS
  222. {
  223. IsRun = k2 == 0 ? IsRun.运行 : IsRun.停止,
  224. WorkStatus = k2 == 0 ? WorkStatus.工作 : WorkStatus.待机,
  225. RobotStatu = k2 == 0 ? WorkStatus.工作 : WorkStatus.待机,
  226. Alarm = new List<AlarmModel> {
  227. new AlarmModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "煮面机警告,水温过低!!!!" },
  228. //new AlarmModel { AlarmTime = DateTime.Now.AddSeconds(1).ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" },
  229. //new AlarmModel { AlarmTime = DateTime.Now.AddSeconds(2).ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" },
  230. },
  231. FailuresCount = 0,
  232. StatsCount = new List<StatsModel> {
  233. new StatsModel { Name = name_s_zm[0], Count = new Random().Next(0, 100) },
  234. new StatsModel { Name = name_s_zm[1], Count = new Random().Next(0, 100) },
  235. new StatsModel { Name = name_s_zm[2], Count = new Random().Next(0, 100) },
  236. new StatsModel { Name = name_s_zm[3], Count = new Random().Next(0, 100) },
  237. new StatsModel { Name = name_s_zm[4], Count = new Random().Next(0, 100) },
  238. },
  239. MorkS_OrderCount = new Random().Next(0, 100),
  240. MorkS_ErrorOrderCount = new Random().Next(0, 100),
  241. Morks_NoodleUpOrDown = new bool[] {
  242. true,true,true,true,false,true
  243. },
  244. MorkS_Temp = false,// k2 == 0 ? "true" : "false",
  245. MorkS_BinLocation = new Random().Next(0, 6),
  246. Morks_SiloMeasUp = k2 == 0 ,
  247. Morks_SiloMeasDown = k2 == 0,
  248. MorkS_NoBowMeas1= new Random().Next(0, 2)==1,
  249. MorkS_NoBowMeas2 = new Random().Next(0, 2) == 1,
  250. MakeOrder = new List<OrderMakeModel> {
  251. new OrderMakeModel { GoodName= name_s_zm[new Random().Next(0, 5)], StartTime=DateTime.Now.ToString("HH:mm:ss"), Status=ORDER_STATUS.WAIT, SortNum="007".ToString()},
  252. new OrderMakeModel { GoodName= name_s_zm[new Random().Next(0, 5)], StartTime=DateTime.Now.ToString("HH:mm:ss"), Status=ORDER_STATUS.WAIT, SortNum="008".ToString()},
  253. new OrderMakeModel { GoodName= name_s_zm[new Random().Next(0, 5)], StartTime=DateTime.Now.ToString("HH:mm:ss"), Status=ORDER_STATUS.WAIT, SortNum="009".ToString()},
  254. new OrderMakeModel { GoodName= name_s_zm[new Random().Next(0, 5)], StartTime=DateTime.Now.ToString("HH:mm:ss"), Status=ORDER_STATUS.WAIT, SortNum="010".ToString()},
  255. new OrderMakeModel { GoodName= name_s_zm[new Random().Next(0, 5)], StartTime=DateTime.Now.ToString("HH:mm:ss"), Status=ORDER_STATUS.WAIT, SortNum="011".ToString()},
  256. new OrderMakeModel { GoodName= name_s_zm[new Random().Next(0, 5)], StartTime=DateTime.Now.ToString("HH:mm:ss"), Status=ORDER_STATUS.COMPLETED_COOK, SortNum="006".ToString()},
  257. new OrderMakeModel { GoodName= name_s_zm[new Random().Next(0, 5)], StartTime=DateTime.Now.ToString("HH:mm:ss"), Status=ORDER_STATUS.COMPLETED_TAKE, SortNum="005".ToString()},
  258. new OrderMakeModel { GoodName= name_s_zm[new Random().Next(0, 5)], StartTime=DateTime.Now.ToString("HH:mm:ss"), Status=ORDER_STATUS.COMPLETED_TAKE, SortNum="004".ToString()},
  259. new OrderMakeModel { GoodName= name_s_zm[new Random().Next(0, 5)], StartTime=DateTime.Now.ToString("HH:mm:ss"), Status=ORDER_STATUS.COMPLETED_TAKE, SortNum="003".ToString()},
  260. new OrderMakeModel { GoodName= name_s_zm[new Random().Next(0, 5)], StartTime=DateTime.Now.ToString("HH:mm:ss"), Status=ORDER_STATUS.COMPLETED_TAKE, SortNum="002".ToString()},
  261. new OrderMakeModel { GoodName= name_s_zm[new Random().Next(0, 5)], StartTime=DateTime.Now.ToString("HH:mm:ss"), Status=ORDER_STATUS.COMPLETED_TAKE, SortNum="001".ToString()},
  262. },
  263. };
  264. }
  265. else if (screen == ScreenDeviceType.分餐机)
  266. {
  267. sendScreenData.Name = screen;
  268. sendScreenData.Value = new ScreenModelSplitMeals
  269. {
  270. IsRun = k2 == 0 ? IsRun.运行 : IsRun.停止,
  271. WorkStatus = k2 == 0 ? WorkStatus.工作 : WorkStatus.待机,
  272. WorkStatus_1 = WorkStatus.待机,
  273. WorkStatus_2 = k2 == 0 ? WorkStatus.工作 : WorkStatus.待机,
  274. WorkStatus_3 = k2 == 0 ? WorkStatus.工作 : WorkStatus.待机,
  275. WorkStatus_4 = k2 == 0 ? WorkStatus.工作 : WorkStatus.待机,
  276. WorkStatus_5 = k2 == 0 ? WorkStatus.工作 : WorkStatus.待机,
  277. WorkStatus_6 = k2 == 0 ? WorkStatus.工作 : WorkStatus.待机,
  278. RobotStatu1= k2 == 0 ? WorkStatus.工作 : WorkStatus.待机,
  279. RobotStatu2 = k2 == 0 ? WorkStatus.工作 : WorkStatus.待机,
  280. RobotStatu = k2 == 0 ? WorkStatus.工作 : WorkStatus.待机,
  281. //Alarm = new List<AlarmModel> {
  282. // new AlarmModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" },
  283. //new AlarmModel { AlarmTime = DateTime.Now.AddSeconds(1).ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" },
  284. //new AlarmModel { AlarmTime = DateTime.Now.AddSeconds(2).ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" },
  285. //},
  286. FailuresCount = 0,
  287. StatsCount = new List<StatsModel> {
  288. new StatsModel { Name = name_s[0], Count = new Random().Next(0, 100) },
  289. new StatsModel { Name = name_s[1], Count = new Random().Next(0, 100) },
  290. new StatsModel { Name = name_s[2], Count = new Random().Next(0, 100) },
  291. new StatsModel { Name = name_s[3], Count = new Random().Next(0, 100) },
  292. new StatsModel { Name = name_s[4], Count = new Random().Next(0, 100) },
  293. },
  294. SplitMeals_CreditCardCount_1 = new Random().Next(0, 100),
  295. SplitMeals_CreditCardNameBefore_1 = name_XM[new Random().Next(0, 5)],
  296. SplitMeals_CreditCardName_1 = name_XM[new Random().Next(0, 5)],
  297. SplitMeals_CookType_1 = new List<string>() { "回锅肉", "烂肉豇豆", "火爆腰花" },
  298. SplitMeals_CreditCardCount_2 = new Random().Next(0, 100),
  299. SplitMeals_CreditCardNameBefore_2 = name_XM[new Random().Next(0, 5)],
  300. SplitMeals_CreditCardName_2 = name_XM[new Random().Next(0, 5)],
  301. SplitMeals_CookType_2 = new List<string>() { "回锅肉", "烂肉豇豆", "火爆腰花" },
  302. SplitMeals_CreditCardCount_3 = new Random().Next(0, 100),
  303. SplitMeals_CreditCardNameBefore_3 = name_XM[new Random().Next(0, 5)],
  304. SplitMeals_CreditCardName_3 = name_XM[new Random().Next(0, 5)],
  305. SplitMeals_CookType_3 = new List<string>() { "回锅肉", "烂肉豇豆", "火爆腰花" },
  306. SplitMeals_CreditCardCount_4 = new Random().Next(0, 100),
  307. SplitMeals_CreditCardNameBefore_4 = name_XM[new Random().Next(0, 5)],
  308. SplitMeals_CreditCardName_4 = name_XM[new Random().Next(0, 5)],
  309. SplitMeals_CookType_4 = new List<string>() { "回锅肉", "烂肉豇豆", "火爆腰花" },
  310. SplitMeals_CreditCardCount_5 = new Random().Next(0, 100),
  311. SplitMeals_CreditCardNameBefore_5 = name_XM[new Random().Next(0, 5)],
  312. SplitMeals_CreditCardName_5 = name_XM[new Random().Next(0, 5)],
  313. SplitMeals_CookType_5 = new List<string>() { "回锅肉", "烂肉豇豆", "火爆腰花" },
  314. SplitMeals_CreditCardCount_6 = new Random().Next(0, 100),
  315. SplitMeals_CreditCardNameBefore_6 = name_XM[new Random().Next(0, 5)],
  316. SplitMeals_CreditCardName_6 = name_XM[new Random().Next(0, 5)],
  317. SplitMeals_CookType_6 = new List<string>() { "回锅肉", "烂肉豇豆", "火爆腰花" },
  318. };
  319. }
  320. string message = JsonConvert.SerializeObject(sendScreenData);
  321. mqttHelper.Publish(ScreenTOPIC.GetInstance.GetTopic(screen), message);
  322. System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() =>
  323. {
  324. if (textwb.Text.Length > 100000)
  325. {
  326. textwb.Text = "";
  327. }
  328. string text = $"{ScreenTOPIC.GetInstance.GetTopic(screen)} {message}\n";
  329. textwb.Text += text;
  330. }));
  331. }
  332. private void Button_Click(object sender, RoutedEventArgs e)
  333. {
  334. int i = 0;
  335. Window1 window1 = new Window1();
  336. foreach (System.Windows.Forms.Screen scr in System.Windows.Forms.Screen.AllScreens)
  337. {
  338. //if (!scr.Primary)
  339. {
  340. if (i == 1)
  341. {
  342. window1.WindowStartupLocation = WindowStartupLocation.Manual;
  343. window1.Left = scr.WorkingArea.Left;
  344. window1.Top = scr.WorkingArea.Top;
  345. window1.Width = scr.Bounds.Width;
  346. window1.Height = scr.Bounds.Height;
  347. window1.WindowState = WindowState.Maximized;
  348. window1.ResizeMode = ResizeMode.NoResize;
  349. window1.WindowStyle = WindowStyle.None;
  350. window1.WindowState = WindowState.Normal;
  351. window1.ShowInTaskbar = false;
  352. window1.Show();
  353. }
  354. else if (i == 2)
  355. {
  356. }
  357. i++;
  358. }
  359. }
  360. }
  361. }
  362. }