示例#1
0
 /// <summary>User connection state changed.</summary>
 /// <param name="sender">Event sender.</param>
 /// <param name="e">Event args.</param>
 void OnUserConnectionStateChanged(object sender, ConnectionEventArgs e)
 {
     if (e.State == ConnectionState.Connected) {
         var user = new Ardelme.Core.User(e.User.Session);
         e.User["user"] = user;
         lock (_realm) { _realm.Enter(user); }
     } else if (e.State == ConnectionState.Disconnected)
         lock (_realm) { _realm.Leave((Ardelme.Core.User)e.User["user"]); }
 }
示例#2
0
 /// <summary>Connection state changed.</summary>
 /// <param name="sender">Event sener.</param>
 /// <param name="e">Event args.</param>
 void OnConnectionStateChanged(object sender, ConnectionEventArgs e)
 {
     _session = e.User != null ? e.User.Session : Guid.Empty;
     var evnt = ConnectionStateChanged;
     if (evnt != null) evnt(this, new MatchDataProviderEventArgs(e.State));
 }