Ejemplo n.º 1
0
        private void NormalOpenButton_Click(object sender, EventArgs e)
        {
            if (_isBusy)
            {
                return;
            }

            using OpenFileDialog fileDialog = new OpenFileDialog
                  {
                      Filter           = "bin files (*.bin)|*.bin|All files (*.*)|*.*",
                      InitialDirectory = Application.StartupPath,
                      Title            = "Open Codeplug File"
                  };

            if (fileDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    NormalStatus.Clear();
                    var codeplug = new Codeplug(fileDialog.FileName);

                    if (codeplug != null)
                    {
                        _codeplug = codeplug;
                        UpdateCodeplug();
                        NormalStatus.Text = _codeplug.GetTextDump();
                    }
                }
                catch (Exception ex)
                {
                    NormalStatus.Text = $"Error opening file {fileDialog.FileName}\r\n{ex}";
                }
            }
        }
Ejemplo n.º 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;
            }
        }