1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- using SecsGem.Core;
- using SecsGem.Core.EnumData;
- using SecsGem.Core.Hsms;
- using SecsGem.Core.ItemModel;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- using System.Windows.Shapes;
- namespace EapClientSimulator
- {
- /// <summary>
- /// UReport.xaml 的交互逻辑
- /// </summary>
- public partial class UStatusVariable : UserControl
- {
- public UStatusVariable()
- {
- InitializeComponent();
- }
- public event EventHandler<string> OnSendMessage;
- private void Query()
- {
- string[] strAry = txtCeId.Text.Split(';');
- Thread thread = new Thread(new ParameterizedThreadStart(CircleQuery));
- thread.IsBackground = true;
- thread.Start(strAry);
- }
- private void CircleQuery(object obj)
- {
- string[] strAry=(string[])obj;
- while (true)
- {
- SecsHsmsMessageHeader secsMessageHeader = new SecsHsmsMessageHeader()
- {
- Stream = 0x01,
- Function = 3,
- SType = SType.DataMessage,
- TransactionId = IdGenerator.GenerateTransactionId(),
- ReplyFlag = true,
- };
- Item item = new SecsGem.Core.ItemModel.ListItem();
- for (int i = 0; i < strAry.Length; i++)
- {
- if (!string.IsNullOrEmpty(strAry[i]))
- {
- if (long.TryParse(strAry[i], out long svid))
- {
- Item ceItem = new LongItem(svid);
- item.AddItem(ceItem);
- }
- else
- {
- return;
- }
- }
- }
- SecsMessage secsMessage = new SecsMessage(secsMessageHeader, item);
- if (GlobalData.Client != null)
- {
- GlobalData.Client.SendMessage(secsMessage);
- if (OnSendMessage != null)
- {
- OnSendMessage(this, SmlSerializationUtil.SerializeItemToString(secsMessage));
- }
- }
- Thread.Sleep(300);
- }
- }
- private void btnQuery_Click(object sender, RoutedEventArgs e)
- {
- Query();
- }
- }
- }
|