protected override void StartSessionInternal(TaskListener <RunningSession> taskListener, SessionStartInfo sessionStartInfo) { Logger.Log(TraceLevel.Info, Stage.Open, StageType.Called, new { sessionStartInfo }); RunningSession newSession = null; bool continueInvocation = true; bool callBase = false; if (continueInvocation) { newSession = new RunningSession() { isNewSession_ = false, SessionId = Guid.NewGuid().ToString() }; SessionIds.Add(newSession.SessionId); Sessions.Add(newSession.SessionId, newSession); SessionsStartInfo.Add(newSession.SessionId, sessionStartInfo); } if (callBase) { base.StartSessionInternal(taskListener, sessionStartInfo); } else { EnsureHttpClient_(); taskListener.OnComplete(newSession); } }
/// <summary> /// Return a JSON-representation of this object. /// </summary> /// <param name="CustomGetChargeDetailRecordsRequestSerializer">A delegate to customize the serialization of GetChargeDetailRecordsRequest responses.</param> public JObject ToJSON(CustomJObjectSerializerDelegate <GetChargeDetailRecordsRequest> CustomGetChargeDetailRecordsRequestSerializer = null) { var JSON = JSONObject.Create( new JProperty("ProviderID", ProviderId.ToString()), new JProperty("From", From.ToIso8601()), new JProperty("To", To.ToIso8601()), SessionIds.SafeAny() ? new JProperty("SessionID", new JArray(SessionIds.Select(sessionId => sessionId.ToString()))) : null, OperatorIds.SafeAny() ? new JProperty("OperatorID", new JArray(SessionIds.Select(sessionId => sessionId.ToString()))) : null, CustomData != null ? new JProperty("CustomData", CustomData) : null ); return(CustomGetChargeDetailRecordsRequestSerializer != null ? CustomGetChargeDetailRecordsRequestSerializer(this, JSON) : JSON); }
public override void Process(XFireClient client) { var friends = client.Server.Database.QueryFriends(_ownerUser); foreach (var friend in friends) { var friendSession = client.Server.GetSession(friend); UserIds.Add(friend.UserId); SessionIds.Add(friendSession != null ? friendSession.SessionId : FriendIsOffLineSessionId); } }
public override async Task Process(IXFireClient client) { var friends = await client.Server.Database.QueryFriends(_ownerUser); foreach (var friend in friends) { var friendSession = client.Server.GetSession(friend); UserIds.Add(friend.Id); SessionIds.Add(friendSession?.SessionId ?? FriendIsOffLineSessionId); } }
/// <summary> /// Create a new Data Exchange client, connected to the server at the end point 'url', with the context <seealso cref="Context"/>, and authenticating with 'apiKey'. </summary> /// <param name="url"> </param> /// <param name="context"> </param> /// <param name="apiKey"> </param> /// <exception cref="GeneralSecurityException"> </exception> /// <exception cref="IOException"> </exception> /// <exception cref="ODataException"> </exception> /// <exception cref="URISyntaxException"> </exception> /// <exception cref="NeotysAPIException"> </exception> internal DataExchangeAPIClientOlingo(string url, Context context, string apiKey) : base(url) { if (Enabled) { ODataEntry createdSession = ReadEntity(SessionIds.SESSION, Sessions.ToProperties(context, apiKey)); this.sessionId = SessionIds.FromEntryProperties(createdSession.AsDictionary()); } else { this.sessionId = ""; } }
public override async Task Process(IXFireClient client) { var friends = (await client.Server.Database.QueryFriends(_ownerUser)) .Select(x => new { User = x, Session = client.Server.GetSession(x) }) .Where(x => x.Session != null); foreach (var friend in friends) { UserIds.Add(friend.User.Id); SessionIds.Add(friend.Session.SessionId); } }
public RunningSession StartSession(SessionStartInfo sessionStartInfo) { logger_.Log("starting session: {0}", sessionStartInfo); var newSession = new RunningSession() { isNewSession_ = false, SessionId = Guid.NewGuid().ToString() }; SessionIds.Add(newSession.SessionId); Sessions.Add(newSession.SessionId, newSession); SessionsStartInfo.Add(newSession.SessionId, sessionStartInfo); return(newSession); }
public void Process(Context context) { var friends = context.Server.Database.QueryFriends(owner); // offline friends are just not sent var friendsSessions = friends.Select(a => context.Server.GetSession(a)) .Where(a => a != null) .ToList(); friendsSessions.ForEach(session => { UserIds.Add(session.User.UserId); SessionIds.Add(session.SessionId); Debug.WriteLine("Status: For:{0} -- FriendId:{1} Friend:{2} FriendSession:{3}", context.User.Username, session.User.UserId, session.User.Username, session.SessionId); }); //friendsSessions.OrderBy(a => a.User.UserId); //friendsSessions.ForEach(session => Debug.WriteLine("Context: For:{0} -- FriendId:{1} Friend:{2} FriendSession:{3}", context.User.Username, session.User.UserId, session.User.Username, session.SessionId)); }
public BetRecord() { InitializeComponent(); using (var db = new SQLiteDB()) { try { //不显示当前局 var last_session_idx = db.BetScoreRecords.Max(mr => mr.SessionIndex); if (last_session_idx == Game.Instance.SessionIndex) { last_session_idx = db.BetScoreRecords.Select(t => t.SessionIndex).Distinct().OrderByDescending(t => t).ElementAt(1); } RecordsInSession = db.BetScoreRecords.Where( r => r.SessionIndex == last_session_idx) .OrderBy(t => t.RoundIndex).ToList(); if (RecordsInSession == null || RecordsInSession.Count == 0) { MessageBox.Show("无记录"); Close(); return; } SessionIds = db.BetScoreRecords.Select(b => b.SessionIndex + 1).Distinct().OrderBy(t => t).ToList(); SessionIds.Remove(Game.Instance.SessionIndex + 1); cmbSessionStrIndex.ItemsSource = SessionIds; cmbSessionStrIndex.SelectedItem = RecordsInSession[0].SessionIndex + 1; } catch (Exception ex) { return; } } CurrentRecords = new ObservableCollection <BetScoreRecord>(RecordsInSession.OrderBy(r => r.RoundIndex).ToList()); ShowWaybillAndDetail(); BindCbEvent(); cmbSessionStrIndex.SelectionChanged += cbRoundStrIndex_SelectionChanged; }
public virtual Pageable <BastionSessionState> DisconnectActiveSessions(string resourceGroupName, string bastionHostName, SessionIds sessionIds, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); } if (bastionHostName == null) { throw new ArgumentNullException(nameof(bastionHostName)); } if (sessionIds == null) { throw new ArgumentNullException(nameof(sessionIds)); } Page <BastionSessionState> FirstPageFunc(int?pageSizeHint) { using var scope = _clientDiagnostics.CreateScope("ServiceOperations.DisconnectActiveSessions"); scope.Start(); try { var response = RestClient.DisconnectActiveSessions(resourceGroupName, bastionHostName, sessionIds, cancellationToken); return(Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } Page <BastionSessionState> NextPageFunc(string nextLink, int?pageSizeHint) { using var scope = _clientDiagnostics.CreateScope("ServiceOperations.DisconnectActiveSessions"); scope.Start(); try { var response = RestClient.DisconnectActiveSessionsNextPage(nextLink, resourceGroupName, bastionHostName, sessionIds, cancellationToken); return(Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } return(PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc)); }
/// <summary> /// Returns the list of currently active sessions on the Bastion. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='bastionHostName'> /// The name of the Bastion Host. /// </param> /// <param name='sessionIds'> /// The list of sessionids to disconnect. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <IPage <BastionSessionState> > DisconnectActiveSessionsAsync(this INetworkManagementClient operations, string resourceGroupName, string bastionHostName, SessionIds sessionIds, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.DisconnectActiveSessionsWithHttpMessagesAsync(resourceGroupName, bastionHostName, sessionIds, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Returns the list of currently active sessions on the Bastion. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='bastionHostName'> /// The name of the Bastion Host. /// </param> /// <param name='sessionIds'> /// The list of sessionids to disconnect. /// </param> public static IPage <BastionSessionState> DisconnectActiveSessions(this INetworkManagementClient operations, string resourceGroupName, string bastionHostName, SessionIds sessionIds) { return(operations.DisconnectActiveSessionsAsync(resourceGroupName, bastionHostName, sessionIds).GetAwaiter().GetResult()); }