private void RunMarker(object sender, DoWorkEventArgs e) { while (true) { for (int i = 0; i < _stations.Count; i++) { _curId = i; Thread.Sleep(1500); ((BackgroundWorker)sender).ReportProgress(0); } if(_message.SFS.AC.T == 1) { if(_message.SFS.AC.M == 0) { _message.SFS.AC.M = 1; } else { MessageBox.Show("Destination address wasn't found!"); _message = new Message(); } } } }
public void ReadMessage(Message message) { InfoTextBox.Text += "*"; // read message? if (message.SFS.AC.T == 1 && message.FcsCoverage.DA == SourceAddress) { message.EFS.FS.A = 1; OutputTextBox.Text = message.FcsCoverage.INFO; } // our message, need delete and frame => marker else if (message.SFS.AC.T == 1 && message.FcsCoverage.SA == SourceAddress && message.EFS.FS.A == 1) { message.SFS.AC.T = 0; message.SFS.AC.M = 0; message.SFS.AC.P = message.SFS.AC.R; message.SFS.AC.R = 1; } // send? else if (!string.IsNullOrEmpty(_sendMessage)) { // if marker => frame if(message.SFS.AC.T == 0 && message.SFS.AC.P <= Priority) { message.SFS.AC.P = Priority; message.SFS.AC.T = 1; message.FcsCoverage.INFO = _sendMessage; _sendMessage = string.Empty; message.FcsCoverage.DA = DestinationAddress; message.FcsCoverage.SA = SourceAddress; message.EFS.FS.A = 0; } else { if(message.SFS.AC.R < Priority) { message.SFS.AC.R = Priority; } } } }