private void OnInstanceRemoved(object sender, InstanceRemovedEventArgs e) { _instanceRemoved?.Invoke(sender, e); }
private void InstanceRemovedEventHandler(Object sender, InstanceRemovedEventArgs e) { // remove the menu item for the removed instance. trayIcon.ContextMenuStrip.Items.RemoveByKey(e.InstanceName); _mainFormInstances.Remove(e.InstanceName); // if we only have one instance left, reload everything so that the context // menu only shows the one instances' menu items. if (_mainFormInstances.Count == 1) LoadInstances(); }