private void serialPortTestMenuItem_Click(object sender, RoutedEventArgs e) { if (_comTransmissionWindow == null || !_comTransmissionWindow.IsVisible) { _comTransmissionWindow = new TransmissionTestWindow(); _comTransmissionWindow.Owner = this; _comTransmissionWindow.Title = "COM transmission test"; var sendHelper = new SendHelper(_serialCommunicator); _comTransmissionWindow.SendDataRequest += sendHelper.Send; _comTransmissionWindow.Show(); } _comTransmissionWindow.Focus(); }
private void lanTestMenuItem_Click(object sender, RoutedEventArgs e) { if (_lanTransmissionWindow == null || !_lanTransmissionWindow.IsVisible) { _lanTransmissionWindow = new TransmissionTestWindow(); _lanTransmissionWindow.Owner = this; _lanTransmissionWindow.Title = "LAN transmission test"; var sendHelper = new SendHelper(_udpCommunicator); _lanTransmissionWindow.SendDataRequest += sendHelper.Send; _lanTransmissionWindow.Show(); } _lanTransmissionWindow.Focus(); }
public MainWindow() { InitializeComponent(); instance = this; SettingsManager.Instance.LoadData(); var tQueues = new Thread(new ThreadStart(QueuesHandler)); tQueues.SetApartmentState(ApartmentState.STA); tQueues.IsBackground = true; tQueues.Start(); _udpCommunicator = new UdpCommunicator(SettingsManager.Instance.data.remoteIp, SettingsManager.Instance.data.remotePort, SettingsManager.Instance.data.localPort, ShowMessage); _udpCommunicator.DataReceived += EnqueueLanMessage; _serialCommunicator = new SerialCommunicator(SettingsManager.Instance.data.serialPort, ShowMessage); _serialCommunicator.DataReceived += EnqueueSerialPortMessage; _lanSendHelper = new SendHelper(_udpCommunicator); _serialSendHelper = new SendHelper(_serialCommunicator); }