private void buttonConnect_Click(object sender, EventArgs e) { if (activeDump == null) return; if (buttonConnect.Text.CompareTo("Подключить")>=0) { if (!activeDump.isConnected()) activeDump.Connect(); if (activeDump.isConnected()) { viewTable.Redraw(activeSub, activeDump, seeking); } } else { if (activeDump.isConnected()) activeDump.Close(); } if (activeDump.isConnected()) buttonConnect.Text="Отключить"; else buttonConnect.Text = "Подключить"; }
static public void Close(string nameSubs) { if (!nameSubs.Contains(".")) { if (!dumps.ContainsKey(nameSubs)) { throw new ArgumentException("Subsystem " + nameSubs + " not supported!"); } Dumper dump = dumps[nameSubs]; dump.Close(); dumps.Remove(nameSubs); return; } if (!masters.ContainsKey(nameSubs)) { throw new ArgumentException("Subsystem and modbus " + nameSubs + " not supported!"); } MasterModbus master = masters[nameSubs]; master.Close(); masters.Remove(nameSubs); }