Beispiel #1
0
        /// <summary>
        /// Posts the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        public Task Post(SendSystemCommand request)
        {
            var name = request.Command;

            if (Enum.TryParse(name, true, out GeneralCommandType commandType))
            {
                name = commandType.ToString();
            }

            var currentSession = GetSession(_sessionContext);
            var command        = new GeneralCommand
            {
                Name = name,
                ControllingUserId = currentSession.UserId
            };

            return(_sessionManager.SendGeneralCommand(currentSession.Id, request.Id, command, CancellationToken.None));
        }
Beispiel #2
0
        /// <summary>
        /// Posts the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        public void Post(SendSystemCommand request)
        {
            GeneralCommandType commandType;

            if (Enum.TryParse(request.Command, true, out commandType))
            {
                var currentSession = GetSession();

                var command = new GeneralCommand
                {
                    Name = commandType.ToString(),
                    ControllingUserId = currentSession.UserId.HasValue ? currentSession.UserId.Value.ToString("N") : null
                };

                var task = _sessionManager.SendGeneralCommand(currentSession.Id, request.Id, command, CancellationToken.None);

                Task.WaitAll(task);
            }
        }