示例#1
0
        private async void NormalWriteButton_Click(object sender, EventArgs e)
        {
            if (_isBusy || _codeplug == null)
            {
                return;
            }
            try
            {
                _isBusy = true;
                NormalStatus.Clear();
                var codeplug = await _codeplug.WriteToRadio((String)NormalComPortComboBox.SelectedValue, new Progress <string>(s => NormalStatus.AppendText(s + Environment.NewLine)));

                NormalStatus.AppendText("Done!");
            }
            finally
            {
                _isBusy = false;
            }

            ////Round Trip Test
            //var sb = new StringBuilder();
            //var x = _codeplug.Serialize();
            //sb.AppendLine($"Original Size: {_codeplug.OriginalBytes.Length:X4} New Size: {x.Length:X4}");

            //for (var i = 0; i < Math.Min(x.Length, _codeplug.OriginalBytes.Length); i++)
            //{
            //    if (_codeplug.OriginalBytes[i] != x[i])
            //    {
            //        sb.AppendLine($"Mismatch {i:X4} Was {_codeplug.OriginalBytes[i]:X2} now {x[i]:X2}");
            //    }
            //}

            //Status.Text = sb.ToString();
        }
示例#2
0
        private async void NormalReadButton_Click(object sender, EventArgs e)
        {
            if (_isBusy)
            {
                return;
            }
            try
            {
                _isBusy = true;
                NormalStatus.Clear();
                _codeplug = null;

                var codeplug = await Codeplug.ReadFromRadio((String)NormalComPortComboBox.SelectedValue, new Progress <string>(s => NormalStatus.AppendText(s + Environment.NewLine)));

                if (codeplug != null)
                {
                    _codeplug = codeplug;
                    UpdateCodeplug();
                    NormalStatus.Text = _codeplug.GetTextDump();
                }
            }
            finally
            {
                _isBusy = false;
            }
        }