commit - 9a5883c65d14c4c5e019658e6540128f8890710b
commit + 972795d01ca15210b4781977fb34eee4731be19f
blob - e580e9349aa1b0db715139c69e9af6b2402b1b25
blob + 2e26c85e251b03df3ce7e0cf99f2811e32097eb0
--- Rabbit_Manager/Foxhunt Rabbit Manager/MainWindow.xaml.cs
+++ Rabbit_Manager/Foxhunt Rabbit Manager/MainWindow.xaml.cs
{
this.Dispatcher.Invoke(() =>
{
-#pragma warning disable CS0103 // The name 'msgBox' does not exist in the current context
msgBox.Text = "No controls received from the rabbit. Trying again.";
-#pragma warning restore CS0103 // The name 'msgBox' does not exist in the current context
DisableAll();
RequestControls();
});
if (portSeconds >= portTimeout && !disConn)
{
-#pragma warning disable CS0103 // The name 'msgBox' does not exist in the current context
msgBox.Text = "Rabbit ping timeout: It appears the WiFi connection is down";
-#pragma warning restore CS0103 // The name 'msgBox' does not exist in the current context
-#pragma warning disable CS0103 // The name 'pingBox' does not exist in the current context
pingBox.Text = "--- ms";
-#pragma warning restore CS0103 // The name 'pingBox' does not exist in the current context
DisableAll();
/*
* one exception to always be able to power off rule,
* since we can't talk anyway
*/
-#pragma warning disable CS0103 // The name 'pwrButton' does not exist in the current context
pwrButton.IsEnabled = false;
-#pragma warning restore CS0103 // The name 'pwrButton' does not exist in the current context
portSeconds = portTimeout;
}
if (!exists && !isClosed)
{
-#pragma warning disable CS0103 // The name 'msgBox' does not exist in the current context
msgBox.Text = "Rabbit remote diconnected";
-#pragma warning restore CS0103 // The name 'msgBox' does not exist in the current context
-#pragma warning disable CS0103 // The name 'pingBox' does not exist in the current context
pingBox.Text = "--- ms";
-#pragma warning restore CS0103 // The name 'pingBox' does not exist in the current context
sPort.Close();
-#pragma warning disable CS0103 // The name 'AttachButton' does not exist in the current context
AttachButton.IsEnabled = false;
-#pragma warning restore CS0103 // The name 'AttachButton' does not exist in the current context
-#pragma warning disable CS0103 // The name 'DettachButton' does not exist in the current context
DettachButton.IsEnabled = false;
-#pragma warning restore CS0103 // The name 'DettachButton' does not exist in the current context
-#pragma warning disable CS0103 // The name 'ComPortsComboBox' does not exist in the current context
ComPortsComboBox.IsEnabled = true;
-#pragma warning restore CS0103 // The name 'ComPortsComboBox' does not exist in the current context
disConn = true;
isClosed = true;
isStarted = false;
this.Dispatcher.Invoke(() =>
{
if (portSeconds < portTimeout && !disConn)
-#pragma warning disable CS0103 // The name 'msgBox' does not exist in the current context
msgBox.Text = "";
-#pragma warning restore CS0103 // The name 'msgBox' does not exist in the current context
});
}
private void LoadPorts()
uint count = 0, reload = 0;
int i = 0;
-#pragma warning disable CS0103 // The name 'ComPortsComboBox' does not exist in the current context
foreach (string item in ComPortsComboBox.Items)
count++;
-#pragma warning restore CS0103 // The name 'ComPortsComboBox' does not exist in the current context
-#pragma warning disable CS0103 // The name 'ComPortsComboBox' does not exist in the current context
if (ports.Length != ComPortsComboBox.Items.Count)
goto load;
-#pragma warning restore CS0103 // The name 'ComPortsComboBox' does not exist in the current context
-#pragma warning disable CS0103 // The name 'ComPortsComboBox' does not exist in the current context
foreach (string item in ComPortsComboBox.Items)
{
-#pragma warning disable CS0103 // The name 'ComPortsComboBox' does not exist in the current context
if (ports[i] != ComPortsComboBox.Items.GetItemAt(i++).ToString())
reload = 1;
-#pragma warning restore CS0103 // The name 'ComPortsComboBox' does not exist in the current context
}
-#pragma warning restore CS0103 // The name 'ComPortsComboBox' does not exist in the current context
if (firstLoad == 1)
goto load;
firstLoad = 0;
this.Dispatcher.Invoke(() =>
{
-#pragma warning disable CS0103 // The name 'ComPortsComboBox' does not exist in the current context
ComPortsComboBox.Items.Clear();
-#pragma warning restore CS0103 // The name 'ComPortsComboBox' does not exist in the current context
foreach (string port in ports)
{
-#pragma warning disable CS0103 // The name 'ComPortsComboBox' does not exist in the current context
ComPortsComboBox.Items.Add(port);
-#pragma warning restore CS0103 // The name 'ComPortsComboBox' does not exist in the current context
}
-#pragma warning disable CS0103 // The name 'msgBox' does not exist in the current context
msgBox.Text = "Select a com port to connect to the rabbit remote";
-#pragma warning restore CS0103 // The name 'msgBox' does not exist in the current context
});
}
private void GetPortClosed(object sender, EventArgs e)
}
private void GetPortHandle()
{
-#pragma warning disable CS0103 // The name 'ComPortsComboBox' does not exist in the current context
if (ComPortsComboBox.SelectedIndex != -1)
{
-#pragma warning disable CS0103 // The name 'AttachButton' does not exist in the current context
AttachButton.IsEnabled = true;
-#pragma warning restore CS0103 // The name 'AttachButton' does not exist in the current context
}
else
{
-#pragma warning disable CS0103 // The name 'AttachButton' does not exist in the current context
AttachButton.IsEnabled = false;
-#pragma warning restore CS0103 // The name 'AttachButton' does not exist in the current context
}
-#pragma warning restore CS0103 // The name 'ComPortsComboBox' does not exist in the current context
}
private void AttachPortHandle(object sender, EventArgs e)
{
-#pragma warning disable CS0103 // The name 'msgBox' does not exist in the current context
msgBox.Text = "Connecting to the rabbit remote";
-#pragma warning restore CS0103 // The name 'msgBox' does not exist in the current context
AttachPort();
-#pragma warning disable CS0103 // The name 'AttachButton' does not exist in the current context
AttachButton.IsEnabled = false;
-#pragma warning restore CS0103 // The name 'AttachButton' does not exist in the current context
-#pragma warning disable CS0103 // The name 'ComPortsComboBox' does not exist in the current context
ComPortsComboBox.IsEnabled = false;
-#pragma warning restore CS0103 // The name 'ComPortsComboBox' does not exist in the current context
-#pragma warning disable CS0103 // The name 'DettachButton' does not exist in the current context
DettachButton.IsEnabled = true;
-#pragma warning restore CS0103 // The name 'DettachButton' does not exist in the current context
}
private void AttachPort()
{
-#pragma warning disable CS0103 // The name 'ComPortsComboBox' does not exist in the current context
pName = ComPortsComboBox.SelectedValue.ToString();
-#pragma warning restore CS0103 // The name 'ComPortsComboBox' does not exist in the current context
sPort = new SerialPort(pName, 115200, Parity.None, 8,
StopBits.One);
try
}
catch (Exception ex)
{
-#pragma warning disable CS0103 // The name 'AttachButton' does not exist in the current context
AttachButton.IsEnabled = true;
-#pragma warning restore CS0103 // The name 'AttachButton' does not exist in the current context
-#pragma warning disable CS0103 // The name 'ComPortsComboBox' does not exist in the current context
ComPortsComboBox.IsEnabled = true;
-#pragma warning restore CS0103 // The name 'ComPortsComboBox' does not exist in the current context
-#pragma warning disable CS0103 // The name 'msgBox' does not exist in the current context
msgBox.Text = "Connection to the rabbit remote failed";
-#pragma warning restore CS0103 // The name 'msgBox' does not exist in the current context
MessageBox.Show("Error: " + ex.ToString(), "ERROR");
return;
}
-#pragma warning disable CS0103 // The name 'DettachButton' does not exist in the current context
DettachButton.IsEnabled = true;
-#pragma warning restore CS0103 // The name 'DettachButton' does not exist in the current context
-#pragma warning disable CS0103 // The name 'msgBox' does not exist in the current context
msgBox.Text = "Connected to the rabbit remote";
-#pragma warning restore CS0103 // The name 'msgBox' does not exist in the current context
-#pragma warning disable CS0103 // The name 'pingBox' does not exist in the current context
pingBox.Text = "--- ms";
-#pragma warning restore CS0103 // The name 'pingBox' does not exist in the current context
portSeconds = 0;
msgTimer.Start();
disConn = false;
private void DettachPortHandle(object sender, EventArgs e)
{
DettachPort();
-#pragma warning disable CS0103 // The name 'msgBox' does not exist in the current context
msgBox.Text = "Disconnected from the rabbit remote";
-#pragma warning restore CS0103 // The name 'msgBox' does not exist in the current context
-#pragma warning disable CS0103 // The name 'pingBox' does not exist in the current context
pingBox.Text = "--- ms";
-#pragma warning restore CS0103 // The name 'pingBox' does not exist in the current context
-#pragma warning disable CS0103 // The name 'AttachButton' does not exist in the current context
AttachButton.IsEnabled = true;
-#pragma warning restore CS0103 // The name 'AttachButton' does not exist in the current context
-#pragma warning disable CS0103 // The name 'DettachButton' does not exist in the current context
DettachButton.IsEnabled = false;
-#pragma warning restore CS0103 // The name 'DettachButton' does not exist in the current context
-#pragma warning disable CS0103 // The name 'ComPortsComboBox' does not exist in the current context
ComPortsComboBox.IsEnabled = true;
-#pragma warning restore CS0103 // The name 'ComPortsComboBox' does not exist in the current context
DisableAll();
msgTimer.Stop();
}
private void EnableAll()
{
-#pragma warning disable CS0103 // The name 'pwrButton' does not exist in the current context
pwrButton.IsEnabled = true;
-#pragma warning restore CS0103 // The name 'pwrButton' does not exist in the current context
-#pragma warning disable CS0103 // The name 'huntButton' does not exist in the current context
huntButton.IsEnabled = true;
-#pragma warning restore CS0103 // The name 'huntButton' does not exist in the current context
-#pragma warning disable CS0103 // The name 'pttButton' does not exist in the current context
pttButton.IsEnabled = true;
-#pragma warning restore CS0103 // The name 'pttButton' does not exist in the current context
-#pragma warning disable CS0103 // The name 'delayBox' does not exist in the current context
delayBox.IsEnabled = true;
-#pragma warning restore CS0103 // The name 'delayBox' does not exist in the current context
-#pragma warning disable CS0103 // The name 'pwrButton' does not exist in the current context
pwrButton.IsEnabled = true;
-#pragma warning restore CS0103 // The name 'pwrButton' does not exist in the current context
-#pragma warning disable CS0103 // The name 'altButton' does not exist in the current context
altButton.IsEnabled = true;
-#pragma warning restore CS0103 // The name 'altButton' does not exist in the current context
-#pragma warning disable CS0103 // The name 'cwButton' does not exist in the current context
cwButton.IsEnabled = true;
-#pragma warning restore CS0103 // The name 'cwButton' does not exist in the current context
-#pragma warning disable CS0103 // The name 'rndButton' does not exist in the current context
rndButton.IsEnabled = true;
-#pragma warning restore CS0103 // The name 'rndButton' does not exist in the current context
-#pragma warning disable CS0103 // The name 'delayBox' does not exist in the current context
delayBox.IsEnabled = true;
-#pragma warning restore CS0103 // The name 'delayBox' does not exist in the current context
-#pragma warning disable CS0103 // The name 'setButton' does not exist in the current context
setButton.IsEnabled = true;
-#pragma warning restore CS0103 // The name 'setButton' does not exist in the current context
-#pragma warning disable CS0103 // The name 'autoButton' does not exist in the current context
autoButton.IsEnabled = true;
-#pragma warning restore CS0103 // The name 'autoButton' does not exist in the current context
}
private void DisableAll()
{
-#pragma warning disable CS0103 // The name 'pwrButton' does not exist in the current context
pwrButton.IsEnabled = false;
-#pragma warning restore CS0103 // The name 'pwrButton' does not exist in the current context
-#pragma warning disable CS0103 // The name 'huntButton' does not exist in the current context
huntButton.IsEnabled = false;
-#pragma warning restore CS0103 // The name 'huntButton' does not exist in the current context
-#pragma warning disable CS0103 // The name 'pttButton' does not exist in the current context
pttButton.IsEnabled = false;
-#pragma warning restore CS0103 // The name 'pttButton' does not exist in the current context
-#pragma warning disable CS0103 // The name 'delayBox' does not exist in the current context
delayBox.IsEnabled = false;
-#pragma warning restore CS0103 // The name 'delayBox' does not exist in the current context
/* we always have the option to turn the trasmitter off */
-#pragma warning disable CS0103 // The name 'pwrButton' does not exist in the current context
pwrButton.IsEnabled = true;
-#pragma warning restore CS0103 // The name 'pwrButton' does not exist in the current context
-#pragma warning disable CS0103 // The name 'altButton' does not exist in the current context
altButton.IsEnabled = false;
-#pragma warning restore CS0103 // The name 'altButton' does not exist in the current context
-#pragma warning disable CS0103 // The name 'cwButton' does not exist in the current context
cwButton.IsEnabled = false;
-#pragma warning restore CS0103 // The name 'cwButton' does not exist in the current context
-#pragma warning disable CS0103 // The name 'rndButton' does not exist in the current context
rndButton.IsEnabled = false;
-#pragma warning restore CS0103 // The name 'rndButton' does not exist in the current context
-#pragma warning disable CS0103 // The name 'delayBox' does not exist in the current context
delayBox.IsEnabled = false;
-#pragma warning restore CS0103 // The name 'delayBox' does not exist in the current context
-#pragma warning disable CS0103 // The name 'setButton' does not exist in the current context
setButton.IsEnabled = false;
-#pragma warning restore CS0103 // The name 'setButton' does not exist in the current context
-#pragma warning disable CS0103 // The name 'autoButton' does not exist in the current context
autoButton.IsEnabled = false;
-#pragma warning restore CS0103 // The name 'autoButton' does not exist in the current context
}
private void DettachPort()
{
}
catch (Exception ex)
{
-#pragma warning disable CS0103 // The name 'AttachButton' does not exist in the current context
AttachButton.IsEnabled = false;
-#pragma warning restore CS0103 // The name 'AttachButton' does not exist in the current context
-#pragma warning disable CS0103 // The name 'DettachButton' does not exist in the current context
DettachButton.IsEnabled = true;
-#pragma warning restore CS0103 // The name 'DettachButton' does not exist in the current context
-#pragma warning disable CS0103 // The name 'ComPortsComboBox' does not exist in the current context
ComPortsComboBox.IsEnabled = false;
-#pragma warning restore CS0103 // The name 'ComPortsComboBox' does not exist in the current context
MessageBox.Show("Error: " + ex.ToString(), "ERROR");
}
}
buf[i++] = preval;
buf[i++] = 0x02;
buf[i++] = 1;
-#pragma warning disable CS0103 // The name 'delayBox' does not exist in the current context
buf[i++] = byte.Parse(delayBox.Text);
-#pragma warning restore CS0103 // The name 'delayBox' does not exist in the current context
for (j = 0; j < i; j++)
sum += buf[j];
DisableAll();
if (bit == huntbit && ((currentControls >> huntbit) & 1) == 1)
{
-#pragma warning disable CS0103 // The name 'huntButton' does not exist in the current context
huntButton.Content = "Stop Hunt";
-#pragma warning restore CS0103 // The name 'huntButton' does not exist in the current context
-#pragma warning disable CS0103 // The name 'DettachButton' does not exist in the current context
DettachButton.IsEnabled = false;
-#pragma warning restore CS0103 // The name 'DettachButton' does not exist in the current context
return;
}
else if (bit == pttbit)
return;
else
-#pragma warning disable CS0103 // The name 'DettachButton' does not exist in the current context
DettachButton.IsEnabled = true;
-#pragma warning restore CS0103 // The name 'DettachButton' does not exist in the current context
reqTimer.Start();
}
this.Dispatcher.Invoke(() =>
{
if (pkt[0] != preval)
-#pragma warning disable CS0103 // The name 'msgBox' does not exist in the current context
msgBox.Text = "Preamble error";
-#pragma warning restore CS0103 // The name 'msgBox' does not exist in the current context
else if (cnt != cnt_req)
-#pragma warning disable CS0103 // The name 'msgBox' does not exist in the current context
msgBox.Text = "Data RX error: " + cnt.ToString() + "::" + cnt_req.ToString();
-#pragma warning restore CS0103 // The name 'msgBox' does not exist in the current context
else
ParseData(pkt);
});
EnableAll();
if (auto == 1)
-#pragma warning disable CS0103 // The name 'autoButton' does not exist in the current context
autoButton.Content = "Disable Auto Hunt";
-#pragma warning restore CS0103 // The name 'autoButton' does not exist in the current context
else
-#pragma warning disable CS0103 // The name 'autoButton' does not exist in the current context
autoButton.Content = "Enable Auto Hunt";
-#pragma warning restore CS0103 // The name 'autoButton' does not exist in the current context
if (hunt == 1)
{
-#pragma warning disable CS0103 // The name 'huntButton' does not exist in the current context
huntButton.Content = "Stop Hunt";
-#pragma warning restore CS0103 // The name 'huntButton' does not exist in the current context
-#pragma warning disable CS0103 // The name 'pttButton' does not exist in the current context
pttButton.IsEnabled = true;
-#pragma warning restore CS0103 // The name 'pttButton' does not exist in the current context
-#pragma warning disable CS0103 // The name 'DettachButton' does not exist in the current context
DettachButton.IsEnabled = false;
-#pragma warning restore CS0103 // The name 'DettachButton' does not exist in the current context
}
else
{
-#pragma warning disable CS0103 // The name 'huntButton' does not exist in the current context
huntButton.Content = "Start Hunt";
-#pragma warning restore CS0103 // The name 'huntButton' does not exist in the current context
-#pragma warning disable CS0103 // The name 'pttButton' does not exist in the current context
pttButton.IsEnabled = false;
-#pragma warning restore CS0103 // The name 'pttButton' does not exist in the current context
-#pragma warning disable CS0103 // The name 'DettachButton' does not exist in the current context
DettachButton.IsEnabled = true;
-#pragma warning restore CS0103 // The name 'DettachButton' does not exist in the current context
}
if (ptt == 1)
{
-#pragma warning disable CS0103 // The name 'huntButton' does not exist in the current context
huntButton.IsEnabled = false;
-#pragma warning restore CS0103 // The name 'huntButton' does not exist in the current context
-#pragma warning disable CS0103 // The name 'pttButton' does not exist in the current context
pttButton.IsEnabled = false;
-#pragma warning restore CS0103 // The name 'pttButton' does not exist in the current context
}
if (pwr == 1)
{
-#pragma warning disable CS0103 // The name 'pwrButton' does not exist in the current context
pwrButton.Content = "Transmitter Power Off";
-#pragma warning restore CS0103 // The name 'pwrButton' does not exist in the current context
-#pragma warning disable CS0103 // The name 'huntButton' does not exist in the current context
huntButton.IsEnabled = true;
-#pragma warning restore CS0103 // The name 'huntButton' does not exist in the current context
if (hunt == 1)
-#pragma warning disable CS0103 // The name 'pttButton' does not exist in the current context
pttButton.IsEnabled = true;
-#pragma warning restore CS0103 // The name 'pttButton' does not exist in the current context
}
else
{
-#pragma warning disable CS0103 // The name 'pwrButton' does not exist in the current context
pwrButton.Content = "Transmitter Power On";
-#pragma warning restore CS0103 // The name 'pwrButton' does not exist in the current context
-#pragma warning disable CS0103 // The name 'huntButton' does not exist in the current context
huntButton.IsEnabled = false;
-#pragma warning restore CS0103 // The name 'huntButton' does not exist in the current context
-#pragma warning disable CS0103 // The name 'pttButton' does not exist in the current context
pttButton.IsEnabled = false;
-#pragma warning restore CS0103 // The name 'pttButton' does not exist in the current context
}
if (rnd == 1)
{
-#pragma warning disable CS0103 // The name 'rndButton' does not exist in the current context
rndButton.Content = "Turn Off Random Delay";
-#pragma warning restore CS0103 // The name 'rndButton' does not exist in the current context
-#pragma warning disable CS0103 // The name 'delayBox' does not exist in the current context
delayBox.IsEnabled = false;
-#pragma warning restore CS0103 // The name 'delayBox' does not exist in the current context
-#pragma warning disable CS0103 // The name 'setButton' does not exist in the current context
setButton.IsEnabled = false;
-#pragma warning restore CS0103 // The name 'setButton' does not exist in the current context
}
else
{
-#pragma warning disable CS0103 // The name 'rndButton' does not exist in the current context
rndButton.Content = "Turn On Random Delay";
-#pragma warning restore CS0103 // The name 'rndButton' does not exist in the current context
-#pragma warning disable CS0103 // The name 'delayBox' does not exist in the current context
delayBox.IsEnabled = true;
-#pragma warning restore CS0103 // The name 'delayBox' does not exist in the current context
-#pragma warning disable CS0103 // The name 'setButton' does not exist in the current context
setButton.IsEnabled = true;
-#pragma warning restore CS0103 // The name 'setButton' does not exist in the current context
}
if (cw == 1)
-#pragma warning disable CS0103 // The name 'cwButton' does not exist in the current context
cwButton.Content = "Turn Off CW";
-#pragma warning restore CS0103 // The name 'cwButton' does not exist in the current context
else
-#pragma warning disable CS0103 // The name 'cwButton' does not exist in the current context
cwButton.Content = "Turn On CW";
-#pragma warning restore CS0103 // The name 'cwButton' does not exist in the current context
if (alt == 1)
{
-#pragma warning disable CS0103 // The name 'altButton' does not exist in the current context
altButton.Content = "Turn Off CW/Voice Alternator";
-#pragma warning restore CS0103 // The name 'altButton' does not exist in the current context
-#pragma warning disable CS0103 // The name 'cwButton' does not exist in the current context
cwButton.Content = "Turn Off CW";
-#pragma warning restore CS0103 // The name 'cwButton' does not exist in the current context
-#pragma warning disable CS0103 // The name 'cwButton' does not exist in the current context
cwButton.IsEnabled = false;
-#pragma warning restore CS0103 // The name 'cwButton' does not exist in the current context
}
else
{
-#pragma warning disable CS0103 // The name 'altButton' does not exist in the current context
altButton.Content = "Turn On CW/Voice Alternator";
-#pragma warning restore CS0103 // The name 'altButton' does not exist in the current context
-#pragma warning disable CS0103 // The name 'cwButton' does not exist in the current context
cwButton.IsEnabled = true;
-#pragma warning restore CS0103 // The name 'cwButton' does not exist in the current context
}
}
private void ParseData(byte[] pkt)
if (fin != calc)
{
-#pragma warning disable CS0103 // The name 'msgBox' does not exist in the current context
msgBox.Text = "Checksum error: " + calc.ToString("X2") + "::" + fin.ToString("X2");
-#pragma warning restore CS0103 // The name 'msgBox' does not exist in the current context
return;
}
case 0x01: // ping request
if (portSeconds >= portTimeout)
{
-#pragma warning disable CS0103 // The name 'msgBox' does not exist in the current context
msgBox.Text = "Rabbit WiFi connection reestablished";
-#pragma warning restore CS0103 // The name 'msgBox' does not exist in the current context
RequestControls();
}
portSeconds = 0;
-#pragma warning disable CS0103 // The name 'pingBox' does not exist in the current context
pingBox.Text = data + " ms";
-#pragma warning restore CS0103 // The name 'pingBox' does not exist in the current context
break;
case 0x02: // transmit deley
-#pragma warning disable CS0103 // The name 'delayBox' does not exist in the current context
delayBox.Text = data.ToString();
-#pragma warning restore CS0103 // The name 'delayBox' does not exist in the current context
break;
case 0x04: // control request
UpdateControls(data);
break;
case 0x06: // disable controls
DisableAll();
-#pragma warning disable CS0103 // The name 'msgBox' does not exist in the current context
msgBox.Text = "Controls disabled during transmission";
-#pragma warning restore CS0103 // The name 'msgBox' does not exist in the current context
break;
default:
break;