示例#1
0
        public async Task CloseSession(string username)
        {
            if (_sessions.ContainsKey(username))
            {
                CardSavrHttpClient client = _sessions[username].client;
                await client.EndAsync();

                _sessions.Remove(username);
            }
        }
示例#2
0
        public async Task <ClientSession> LoginAndCreateSession(string username,
                                                                string password,
                                                                string trace = null)
        {
            if (_sessions.ContainsKey(username))
            {
                return(_sessions[username]);
            }
            CardSavrHttpClient session = new CardSavrHttpClient(_rejectUnauthorized);

            session.Setup(_cardsavrServer, _appKey, _appName, username, password, trace);
            CardSavrResponse <LoginResult> login = await session.Init();

            _sessions[username] = new ClientSession {
                client = session
            };
            return(_sessions[username]);
        }