private void AddToProcessedDataGrid(ZastoneV77ChannelStructre st) { if (string.IsNullOrEmpty(st.ToneDec)) { return; } var myArray = new object[] { st.RXFreq, st.ToneDec, st.TXFreq, st.ToneEnc, st.ScanAdd, st.WideNarrow, st.Txpower, st.BusyLock, st.Scramble, st.Compander, st.PTTID }; if (this.InvokeRequired) { processedDataGrid.Invoke((MethodInvoker)(() => processedDataGrid.Rows.Add(myArray))); } else { processedDataGrid.Rows.Add(myArray); } ZastoneV77Decoder.ClearStaticVariable(); }
private void OnMessageReceivedHandler(object sender, MessageReceivedEventArgs args) { var res = ByteArrayToHexString(args.Data); WriteReceivedDataToGrid(res); if (prepareRadioForCommunicationCommands[_counter - 1].IsDecodable) { if (prepareRadioForCommunicationCommands[_counter - 1].CommandResultType == CommandResultType.ChannelInformation) { AddToProcessedDataGrid(ZastoneV77Decoder.DecodeFrequenciesForRXandTx(res)); } else if (prepareRadioForCommunicationCommands[_counter - 1].CommandResultType == CommandResultType.ToneInformation) { AddToProcessedDataGrid(ZastoneV77Decoder.DecodeRXandTxTones(res)); } } if (_counter != prepareRadioForCommunicationCommands.Count) { SendCommandsToRadio(); } /*else if (_counter == prepareRadioForCommunicationCommands.Count) * { * * } */ else { _sp.MessageReceived -= OnMessageReceivedHandler; _sp.Disconnect(); } }