private void ConnectedPorts_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if (e.Action == NotifyCollectionChangedAction.Add) { PortConnected?.Invoke(sender, sender as IPort); } else if (e.Action == NotifyCollectionChangedAction.Remove) { PortDisconnected?.Invoke(sender, sender as IPort); } }
private void OnPortConnected() { PortConnected?.Invoke(this, EventArgs.Empty); }
void IHandle <PortConnected> .Handle(PortConnected message) { addBatteryToolStripMenuItem.Enabled = true; clusterToolStripMenuItem.Enabled = true; }
/// <summary> /// Подключить терминал к порту /// </summary> /// <param name="terminal"></param> internal void ConnectTerminal(ITerminal terminal) { PortConnected?.Invoke(this, new PortEventArgs($"Port №{PortNumber}: Терминал {terminal.Name} подключен к порту с абон. номером {AbonentNumber}")); }