Message |
Occurs when on state changed.
Namespace: Gamanet.C4.SDK
Assembly: Gamanet.C4.SimpleClient (in Gamanet.C4.SimpleClient.dll) Version: 2026.0.0.733
Syntax
C#
public event EventHandler<MessagePumpStateChangedEventArgsV1> OnStateChanged
Value
EventHandler<MessagePumpStateChangedEventArgsV1>Implements
ISimpleClientMessagePumpV1.OnStateChangedExample
The following example illustrates how to handling message pump state.
C#
using System; using Gamanet.C4.SDK; using Gamanet.C4.SimpleInterfaces; public class OnStateChanged { static void Main() { // create instance of simple client var client = new SimpleClient(ConnectorConfiguration.HttpClient, null); ConnectionInfo token; // connect to local server var connectionResult = client.Connect(new Uri("https://localhost/"), "Support", "support", out token); if (connectionResult != ConnectionResult.Successful) { Console.WriteLine("Connection unSuccessful, result: {0}", connectionResult); return; } Console.WriteLine("Connection result: {0}", connectionResult); Console.WriteLine(); // start handling message pump statuses // MessagePumpState display state of message pump client.MessagePump.OnStateChanged += OnMessagePumpStateChanged; // start message pump client.MessagePump.Start(); // stop message pump client.MessagePump.Stop(); // stop handling message pump statuses client.MessagePump.OnStateChanged -= OnMessagePumpStateChanged; // disconnect from server client.Disconnect(); // The example displays the following output: // Connection result: Successful // Message Pump state: Started // Message Pump state: Stopped } private static void OnMessagePumpStateChanged(object sender, MessagePumpStateChangedEventArgs e) { Console.WriteLine("Message Pump state: {0}", e.MessagePumpState); } }
See Also