protected override void handleConnectionEvent(object Sender, ConnectionEvent e) { if(e.Event == ConnectionEvent.eConnectionEvent.eceConnect) { ConsoleEventLog.addEvent(new ConsoleEvent("Client " + e.Host + " connected."), true); } else { if(!NotifiedLoggedOff) { ClientContainer.UserEvent(UserEventType.LogOut, this); this.NotifiedLoggedOff = true; this.LoggedIn = false; List<HostedGame> ret = GameBox.RemoveByUID(User.UID); foreach(HostedGame b in ret) { SocketMessage stemp2 = new SocketMessage("UNHOST"); String gstring = Convert.ToBase64String(HostedGame.Serialize(b)); stemp2.Arguments.Add(gstring); ClientContainer.AllUserCommand(stemp2); } } ConsoleEventLog.addEvent(new ConsoleEvent("Client " + e.Host + " disconnected ."), true); } }
internal ConnectionEventTimeline(IInspectorContext context, DbConnection connection, Guid connectionId, ConnectionEvent connectionEvent) : base(context) { _connection = connection; _connectionId = connectionId; _connectionEvent = connectionEvent; }
private uint HandleEventShutdownInitiatedByTransport(ConnectionEvent connectionEvent) { if (!_connected) { _connectTcs.CompleteException(new IOException("Connection has been shutdown.")); } _acceptQueue.Writer.Complete(); return(MsQuicStatusCodes.Success); }
internal uint HandleEvent(ref ConnectionEvent connectionEvent) { var status = MsQuicConstants.Success; switch (connectionEvent.Type) { case QUIC_CONNECTION_EVENT.CONNECTED: { status = HandleEventConnected( connectionEvent); } break; case QUIC_CONNECTION_EVENT.SHUTDOWN_BEGIN: { status = HandleEventShutdownBegin( connectionEvent); } break; case QUIC_CONNECTION_EVENT.SHUTDOWN_BEGIN_PEER: { status = HandleEventShutdownBeginPeer( connectionEvent); } break; case QUIC_CONNECTION_EVENT.SHUTDOWN_COMPLETE: { status = HandleEventShutdownComplete( connectionEvent); } break; case QUIC_CONNECTION_EVENT.NEW_STREAM: { status = HandleEventNewStream( connectionEvent); } break; case QUIC_CONNECTION_EVENT.STREAMS_AVAILABLE: { status = HandleEventStreamsAvailable( connectionEvent); } break; default: break; } return(status); }
private static uint NativeCallbackHandler( IntPtr connection, IntPtr context, ref ConnectionEvent connectionEvent) { var state = (State)GCHandle.FromIntPtr(context).Target !; if (NetEventSource.Log.IsEnabled()) { NetEventSource.Info(state, $"[Connection#{state.GetHashCode()}] received event {connectionEvent.Type}"); } try { switch (connectionEvent.Type) { case QUIC_CONNECTION_EVENT_TYPE.CONNECTED: return(HandleEventConnected(state, ref connectionEvent)); case QUIC_CONNECTION_EVENT_TYPE.SHUTDOWN_INITIATED_BY_TRANSPORT: return(HandleEventShutdownInitiatedByTransport(state, ref connectionEvent)); case QUIC_CONNECTION_EVENT_TYPE.SHUTDOWN_INITIATED_BY_PEER: return(HandleEventShutdownInitiatedByPeer(state, ref connectionEvent)); case QUIC_CONNECTION_EVENT_TYPE.SHUTDOWN_COMPLETE: return(HandleEventShutdownComplete(state, ref connectionEvent)); case QUIC_CONNECTION_EVENT_TYPE.PEER_STREAM_STARTED: return(HandleEventNewStream(state, ref connectionEvent)); case QUIC_CONNECTION_EVENT_TYPE.STREAMS_AVAILABLE: return(HandleEventStreamsAvailable(state, ref connectionEvent)); case QUIC_CONNECTION_EVENT_TYPE.PEER_CERTIFICATE_RECEIVED: return(HandleEventPeerCertificateReceived(state, ref connectionEvent)); default: return(MsQuicStatusCodes.Success); } } catch (Exception ex) { if (NetEventSource.Log.IsEnabled()) { NetEventSource.Error(state, $"Exception occurred during connection callback: {ex.Message}"); } // TODO: trigger an exception on any outstanding async calls. return(MsQuicStatusCodes.InternalError); } }
private void AddDisconnectEvent(BattleNetErrors error) { ConnectionEvent <PacketType> item = new ConnectionEvent <PacketType> { Type = ConnectionEventTypes <PacketType> .OnDisconnected, Error = error }; object mutex = this.m_mutex; lock (mutex) { this.m_connectionEvents.Add(item); } }
/// <summary> /// Disconnects the dashboard from the robot. /// </summary> public void Disconnect() { // Get the previous connection state bool previousConnectionState = IsConnected; NetworkTable.Shutdown(); // If we were connected before disconnect, notify elements if (previousConnectionState) { ConnectionEvent?.Invoke(this, IsConnected); } }
public override void OnEvent(IEvent _event) { EventType eventType = _event.GetEventType(); switch (eventType) { case EventType.Connection: ConnectionEvent connectionEvent = (ConnectionEvent)_event; IApplication application = new WindowsApplication(connectionEvent.Connection); EventConduit.SendEvent(new WindowsApplicationEvent(application)); break; } }
private static uint HandleEventNewStream(State state, ref ConnectionEvent connectionEvent) { var streamHandle = new SafeMsQuicStreamHandle(connectionEvent.Data.PeerStreamStarted.Stream); if (!state.TryQueueNewStream(streamHandle, connectionEvent.Data.PeerStreamStarted.Flags)) { // This will call StreamCloseDelegate and free the stream. // We will return Success to the MsQuic to prevent double free. streamHandle.Dispose(); } return(MsQuicStatusCodes.Success); }
private uint HandleEventShutdownInitiatedByTransport(ref ConnectionEvent connectionEvent) { if (!_connected) { uint hresult = connectionEvent.Data.ShutdownInitiatedByTransport.Status; Exception ex = QuicExceptionHelpers.CreateExceptionForHResult(hresult, "Connection has been shutdown by transport."); _connectTcs.SetException(ExceptionDispatchInfo.SetCurrentStackTrace(ex)); } _acceptQueue.Writer.Complete(); return(MsQuicStatusCodes.Success); }
private void ConnectionHandler(object parameter, ConnectionEvent connectionEvent) { switch (connectionEvent) { case ConnectionEvent.OPENED: SetValueByName(this, "ConnectionStatus", true); break; case ConnectionEvent.CLOSED: SetValueByName(this, "ConnectionStatus", false); break; } }
private uint HandleEventConnected(ConnectionEvent connectionEvent) { SOCKADDR_INET inetAddress = MsQuicParameterHelpers.GetINetParam(MsQuicApi.Api, _ptr, (uint)QUIC_PARAM_LEVEL.CONNECTION, (uint)QUIC_PARAM_CONN.LOCAL_ADDRESS); _localEndPoint = MsQuicAddressHelpers.INetToIPEndPoint(inetAddress); _connected = true; // I don't believe we need to lock here because // handle event connected will not be called at the same time as // handle event shutdown initiated by transport _connectTcs.Complete(MsQuicStatusCodes.Success); return(MsQuicStatusCodes.Success); }
private void AddConnectEvent(BattleNetErrors error, Exception exception = null) { ConnectionEvent <PacketType> item = new ConnectionEvent <PacketType> { Type = ConnectionEventTypes <PacketType> .OnConnected, Error = error, Exception = exception }; object mutex = this.m_mutex; lock (mutex) { this.m_connectionEvents.Add(item); } }
// got a response for trying to connect to the server private void OnConnection(ConnectionEvent e) { // connected or not don't need to have this anymore. since these are delegates need to be careful to remove them when not needed _server.EventDispatcher.ConnectionEvent -= OnConnection; // just pass the info through if (ConnectionEvent != null) { ConnectionEvent(new Dictionary <string, object>() { { "success", e.Success }, { "error", e.Error } }); } }
private static void HandleConnectionEvent(ConnectionEvent connectionEvent) { var manager = GlobalManager.GetManager <ConnectionManager>(); switch ((ConnectionEvent.Events)connectionEvent.Action) { case ConnectionEvent.Events.ConnectToServer: manager.ConnectToServer((EventConnectToServer)connectionEvent); break; default: throw new ArgumentOutOfRangeException(string.Format("ConnectionEvent '{0}' is not handled in the EventDispatcher.", connectionEvent.Action)); } }
private void OnConnect(IAsyncResult ar) { var sock = (Socket)ar.AsyncState; { if (sock.Connected) { p_wsStatus = Connected; ConnectionEvent?.Invoke(true); } else { sock.Close(); } } }
private uint HandleEventShutdownComplete(ConnectionEvent connectionEvent) { if (NetEventSource.IsEnabled) { NetEventSource.Enter(this); } _shutdownTcs.Complete(MsQuicStatusCodes.Success); if (NetEventSource.IsEnabled) { NetEventSource.Exit(this); } return(MsQuicStatusCodes.Success); }
private static uint HandleEventShutdownInitiatedByTransport(State state, ref ConnectionEvent connectionEvent) { if (!state.Connected) { Debug.Assert(state.Connection != null); state.Connection = null; uint hresult = connectionEvent.Data.ShutdownInitiatedByTransport.Status; Exception ex = QuicExceptionHelpers.CreateExceptionForHResult(hresult, "Connection has been shutdown by transport."); state.ConnectTcs.SetException(ExceptionDispatchInfo.SetCurrentStackTrace(ex)); } state.AcceptQueue.Writer.Complete(); return(MsQuicStatusCodes.Success); }
/// <summary> /// Метод получения inf файлов /// </summary> /// <param name="path"></param> /// <returns></returns> private bool GetInf(string path) { try { ConnectionEvent?.Invoke($"Получение *.inf {path.RemoveText()}"); infMass = Directory.GetFiles(path, "*.inf", SearchOption.AllDirectories); return(true); } catch { return(false); } }
private void sock_onConnectionEvent(object Sender, ConnectionEvent e) { if(e.Event == ConnectionEvent.eConnectionEvent.eceConnect) { addline("#Connected"); SocketMessage sm = new SocketMessage("RC"); sm.getMessage(); sock.writeMessage(sm); //sock.writeMessage(sm); } else { addline("#Disconnected"); sock.Connect("www.skylabsonline.com", 5583); } }
private static uint HandleEventShutdownComplete(State state, ref ConnectionEvent connectionEvent) { // This is the final event on the connection, so free the GCHandle used by the event callback. state.StateGCHandle.Free(); if (state.ListenerState != null) { // This is inbound connection that never got connected - becasue of TLS validation or some other reason. // Remove connection from pending queue and dispose it. if (state.ListenerState.PendingConnections.TryRemove(state.Handle.DangerousGetHandle(), out MsQuicConnection? connection)) { connection.Dispose(); } state.ListenerState = null; } state.Connection = null; state.ShutdownTcs.SetResult(MsQuicStatusCodes.Success); // Stop accepting new streams. state.AcceptQueue.Writer.TryComplete(); // Stop notifying about available streams. TaskCompletionSource?unidirectionalTcs = null; TaskCompletionSource?bidirectionalTcs = null; lock (state) { unidirectionalTcs = state.NewUnidirectionalStreamsAvailable; bidirectionalTcs = state.NewBidirectionalStreamsAvailable; state.NewUnidirectionalStreamsAvailable = null; state.NewBidirectionalStreamsAvailable = null; } if (unidirectionalTcs is not null) { unidirectionalTcs.SetException(ExceptionDispatchInfo.SetCurrentStackTrace(new QuicOperationAbortedException())); } if (bidirectionalTcs is not null) { bidirectionalTcs.SetException(ExceptionDispatchInfo.SetCurrentStackTrace(new QuicOperationAbortedException())); } return(MsQuicStatusCodes.Success); }
private static uint HandleEventConnected(State state, ref ConnectionEvent connectionEvent) { if (state.Connected) { return(MsQuicStatusCodes.Success); } if (state.IsServer) { state.Connected = true; MsQuicListener.State?listenerState = state.ListenerState; state.ListenerState = null; if (listenerState != null) { if (listenerState.PendingConnections.TryRemove(state.Handle.DangerousGetHandle(), out MsQuicConnection? connection)) { // Move connection from pending to Accept queue and hand it out. if (listenerState.AcceptConnectionQueue.Writer.TryWrite(connection)) { return(MsQuicStatusCodes.Success); } // Listener is closed connection.Dispose(); } } return(MsQuicStatusCodes.UserCanceled); } else { // Connected will already be true for connections accepted from a listener. Debug.Assert(!Monitor.IsEntered(state)); Debug.Assert(state.Connection != null); state.Connection._localEndPoint = MsQuicParameterHelpers.GetIPEndPointParam(MsQuicApi.Api, state.Handle, (uint)QUIC_PARAM_CONN.LOCAL_ADDRESS); state.Connection.SetNegotiatedAlpn(connectionEvent.Data.Connected.NegotiatedAlpn, connectionEvent.Data.Connected.NegotiatedAlpnLength); state.Connection = null; state.Connected = true; state.ConnectTcs !.SetResult(MsQuicStatusCodes.Success); state.ConnectTcs = null; } return(MsQuicStatusCodes.Success); }
private uint HandleEventConnected(ref ConnectionEvent connectionEvent) { if (!_connected) { // _connected will already be true for connections accepted from a listener. SOCKADDR_INET inetAddress = MsQuicParameterHelpers.GetINetParam(MsQuicApi.Api, _ptr, (uint)QUIC_PARAM_LEVEL.CONNECTION, (uint)QUIC_PARAM_CONN.LOCAL_ADDRESS); _localEndPoint = MsQuicAddressHelpers.INetToIPEndPoint(ref inetAddress); SetNegotiatedAlpn(connectionEvent.Data.Connected.NegotiatedAlpn, connectionEvent.Data.Connected.NegotiatedAlpnLength); _connected = true; _connectTcs.SetResult(MsQuicStatusCodes.Success); } return(MsQuicStatusCodes.Success); }
private uint HandleEventNewStream(ConnectionEvent connectionEvent) { if (NetEventSource.IsEnabled) { NetEventSource.Enter(this); } MsQuicStream msQuicStream = new MsQuicStream(this, connectionEvent.StreamFlags, connectionEvent.Data.NewStream.Stream, inbound: true); _acceptQueue.Writer.TryWrite(msQuicStream); if (NetEventSource.IsEnabled) { NetEventSource.Exit(this); } return(MsQuicStatusCodes.Success); }
/////////////////////////////////////////////////////////////////////////////////////////////////////// ///////// /////////// ///////// serverConnection /////////// ///////// /////////// /////////////////////////////////////////////////////////////////////////////////////////////////////// private void OnConnectionServiceEventInvoked(ConnectionEvent connectionEvent) { switch (connectionEvent) { case ConnectionEvent.ConnectionEstablished: ApplyWorkflowEvent(WorkflowEvent.ConnectionEstablished); break; case ConnectionEvent.Disconnected: ApplyWorkflowEvent(WorkflowEvent.Disconnected); break; case ConnectionEvent.ConAttemptUnsuccessful: ApplyWorkflowEvent(WorkflowEvent.ConAttemptUnsuccessful); break; case ConnectionEvent.ConnectionLost: ApplyWorkflowEvent(WorkflowEvent.ConnectionLost); break; case ConnectionEvent.StartedTryConnect: ApplyWorkflowEvent(WorkflowEvent.StartedTryConnect); break; case ConnectionEvent.StartedTryDisconnect: ApplyWorkflowEvent(WorkflowEvent.StartedTryDisconnect); break; } }
private static void ListenForClients() { while (!socketCancellationTokenSource.IsCancellationRequested) { try { TcpClient client = tcpListner.AcceptTcpClient(); ConnectionEvent?.Invoke(null, new SocketConnectionMsg(client, client.Client.RemoteEndPoint.ToString())); Task.Run(() => ListenForData(client)); } catch (Exception e) { Console.WriteLine(e); throw; } } }
/// <summary> /// Fired on connect and disconnect events by NetworkTables itself /// </summary> /// <param name="arg1"></param> /// <param name="arg2"></param> /// <param name="arg3"></param> private void OnConnectionEvent(IRemote arg1, ConnectionInfo arg2, bool arg3) { /*Call the connected event from the main thread. * Only notify of disconnects, connects are handled elsewhere in the Connect() method. */ if (previousConnectedState == arg3) { return; } else { previousConnectedState = arg3; } if (!arg3) { mainDispatcher.Invoke(() => ConnectionEvent?.Invoke(this, IsConnected)); } }
void _hubConnection_StateChanged(StateChange obj) { if (this.State == ConnectionState.Connected) { if (ConnectionEvent != null) { ConnectionEvent.Invoke(true); } } else { if (ConnectionEvent != null) { ConnectionEvent.Invoke(false); } } HubClientEvents.Log.ClientEvents("_hubConnection_StateChanged New State:" + _hubConnection.State + " " + _hubConnection.ConnectionId); }
/// <summary> /// Метод запуска установки драйверов /// </summary> /// <param name="drivers"></param> private void InstallDrv(List <Driver> drivers) { foreach (var t in drivers) { while (!GetInf(t.DriverPath)) { int i = 1; ConnectionEvent?.Invoke($"Отсутствие подключения. Попытка {i}"); log.Log($"{DateTime.Now} Установка: {t.DriverPath.RemoveText()} Ожидание получения *.inf\n"); Thread.Sleep(3000); i++; } t.InfProgBarMax = infMass.Length; log.Log($"{DateTime.Now} Установка: {t.DriverPath} Начало установки\n"); if (!InstallInf(t)) { log.Log($"{DateTime.Now} Установка: {t.DriverPath} завершена\n"); OutputEvent?.Invoke($"{t.DriverPath} завершена", t.CheckedDrv = false); } else { break; } } if (!abortInstall) { OutputEvent?.Invoke("завершена", false); log.Log($"{DateTime.Now} Установка: полностью завершена\n"); } else { File.AppendAllText("Install_log.txt", $"{DateTime.Now} Установка: отменена\n"); OutputEvent?.Invoke($"отменена", true); } }
private void StartHubInternal() { try { _hubConnection.Start().Wait(); Connected = true; ConnectionEvent?.Invoke(true); } catch (Exception ex) { Connected = false; var logMsg = "Próba połączenia z serwisem Hermes. " + ex.Message; using (EventLog eventLog = new EventLog("Application")) { eventLog.Source = "Application"; eventLog.WriteEntry(logMsg, EventLogEntryType.Error); } } }
private static uint HandleEventConnected(State state, ref ConnectionEvent connectionEvent) { if (!state.Connected) { // Connected will already be true for connections accepted from a listener. Debug.Assert(!Monitor.IsEntered(state)); SOCKADDR_INET inetAddress = MsQuicParameterHelpers.GetINetParam(MsQuicApi.Api, state.Handle, QUIC_PARAM_LEVEL.CONNECTION, (uint)QUIC_PARAM_CONN.LOCAL_ADDRESS); Debug.Assert(state.Connection != null); state.Connection._localEndPoint = MsQuicAddressHelpers.INetToIPEndPoint(ref inetAddress); state.Connection.SetNegotiatedAlpn(connectionEvent.Data.Connected.NegotiatedAlpn, connectionEvent.Data.Connected.NegotiatedAlpnLength); state.Connection = null; state.Connected = true; state.ConnectTcs !.SetResult(MsQuicStatusCodes.Success); state.ConnectTcs = null; } return(MsQuicStatusCodes.Success); }
public void DisconnectFromPort() { if (TelephoneStatus == TelephoneStatus.Disabled) { DisplayMethod?.Invoke($"{this.SerialNumber} is Already Disconnected"); return; } var connectionEvent = new ConnectionEvent(null); OnDisconnectedFromPort(connectionEvent); Mapping.SeparateTelephoneAndPortBehaviorWhenDisconnecting(this, connectionEvent.Port as IPort); Mapping.DisconnectTelephoneFromPort(this, connectionEvent.Port as IPort); TelephoneStatus = TelephoneStatus.Disabled; DisplayMethod?.Invoke($"{this.SerialNumber} was disconnected"); }
private uint HandleEventShutdownInitiatedByTransport(ConnectionEvent connectionEvent) { if (NetEventSource.IsEnabled) { NetEventSource.Enter(this); } if (!_connected) { _connectTcs.CompleteException(new IOException("Connection has been shutdown.")); } _acceptQueue.Writer.Complete(); if (NetEventSource.IsEnabled) { NetEventSource.Exit(this); } return(MsQuicStatusCodes.Success); }
private void ConnectHandler(object sender, ConnectionEvent connectionEvent) { ConnectionEndPoint.EstablishConnection(connectionEvent.GetAddress); }
private void DisconnectHandler(object sender, ConnectionEvent e) { ConnectionEndPoint.CloseConnections(); AudioTimer.Stop(); }
internal static ConnectionEventTimeline CreateEventTimeline(DbConnection connection, Guid connectionId, ConnectionEvent connectionEvent) { return new ConnectionEventTimeline(_context, connection, connectionId, connectionEvent); }
public void Init(SecondLife client) { Form = new frmAccountant(client); OnConnection = new ConnectionEvent(Form.Connected); }
private void LobbyClient_onConnectionEvent(object Sender, ConnectionEvent e) { switch(e.Event) { case ConnectionEvent.eConnectionEvent.eceConnect: try { eLogEvent.Invoke("CON"); } catch(Exception ex) { }; break; case ConnectionEvent.eConnectionEvent.eceDisconnect: try { loggedIn = false; eLogEvent.Invoke("DC"); } catch(Exception ex) { } unregEvents(); break; } }
/// <summary> /// Whenever this Connects or Disconnects, this is fired. /// </summary> /// <param name="Sender">Object that Connected or Disconnected.</param> /// <param name="e">Information about the Connection or Disconnection</param> /// <seealso cref="ConnectionEvent.cs"/> protected virtual void handleConnectionEvent(object Sender, ConnectionEvent e) { }
public void OnQuiConnection(ConnectionEvent type, string address, int port) { if (!InvokeRequired) { this.addressBox.Text = address; this.portNumberSelection.Value = (decimal)port; if (!QuicheProvider.Instance.Client.Connect && !QuicheProvider.Instance.Client.Connected) { this.connectButton.Text = "Connect"; this.addressBox.Enabled = true; this.portNumberSelection.Enabled = true; } else this.connectButton.Text = type == ConnectionEvent.Connected ? "Disconnect" : type == ConnectionEvent.Error ? "Cancel" : "Connect"; this.connectButton.Enabled = true; } else this.BeginInvoke(new Action<ConnectionEvent, string, int>(this.OnQuiConnection), type, address, port); }
public void Init(SecondLife client) { Form = new frmPrimImporter(client); OnConnection = new ConnectionEvent(Form.Connected); }
private void _rSock_onConnectionEvent(object Sender, ConnectionEvent e) { if(e.Event == ConnectionEvent.eConnectionEvent.eceDisconnect) { _lSock.Close(); } }
internal ConnectionEventTimelineMessage(DbConnection connection, Guid connectionId, ConnectionEvent connectionEvent) { ConnectionId = connectionId; Database = connection.Database; ConnectionEvent = connectionEvent; }
/// <summary> /// Creates new instance of <see cref="ConnectionEventArgs"/> class /// </summary> /// <param name="name">name of the reported connnection</param> /// <param name="eventType">kind of the event</param> public ConnectionEventArgs(string name, ConnectionEvent eventType) { this.name = name; this.eventType = eventType; }
void OnQuiConnection(ConnectionEvent type, string address, int port) { if (!InvokeRequired) { switch (type) { case ConnectionEvent.Error: if (this.lastWarning.AddSeconds(5) < DateTime.Now) { this.lastWarning = DateTime.Now; this.notifyIcon1.BalloonTipIcon = ToolTipIcon.Warning; this.notifyIcon1.BalloonTipTitle = "QuiRing Connection Error"; this.notifyIcon1.BalloonTipText = string.Format("Warning: Connection to Qui on {0}:{1} has been lost.\nLogging will continue when a connection is re-established", address, port); this.notifyIcon1.ShowBalloonTip(2000); this.notifyIcon1.Text = string.Format("QuiRing (Trying to connect)"); } this.notifyIcon1.Icon = global::QuiRing.Icons.Icons_quiFault; break; case ConnectionEvent.Connected: this.notifyIcon1.BalloonTipIcon = ToolTipIcon.Info; this.notifyIcon1.BalloonTipTitle = "QuiRing Connected"; this.notifyIcon1.BalloonTipText = string.Format("Connected to Qui on {0}:{1}", address, port); this.notifyIcon1.ShowBalloonTip(500); this.notifyIcon1.Text = string.Format("QuiRing (Connected)"); this.notifyIcon1.Icon = global::QuiRing.Icons.Icons_quiConnected; break; case ConnectionEvent.Disconnected: this.notifyIcon1.BalloonTipIcon = ToolTipIcon.Info; this.notifyIcon1.BalloonTipTitle = "Qui Disconnected"; this.notifyIcon1.BalloonTipText = string.Format("Disconnected from Qui", address, port); this.notifyIcon1.ShowBalloonTip(500); this.notifyIcon1.Text = string.Format("QuiRing (Disconnected)"); this.notifyIcon1.Icon = global::QuiRing.Icons.Icons_qui; break; } } else this.BeginInvoke(new Action<ConnectionEvent, string, int>(this.OnQuiConnection), type, address, port); }