Пример #1
0
 /// <summary>
 /// Constructs a LCIMClient with client id.
 /// </summary>
 /// <param name="clientId"></param>
 /// <param name="tag"></param>
 /// <param name="deviceId"></param>
 /// <param name="signatureFactory"></param>
 public LCIMClient(string clientId,
                   string tag      = null,
                   string deviceId = null,
                   ILCIMSignatureFactory signatureFactory = null)
 {
     if (string.IsNullOrEmpty(clientId))
     {
         throw new ArgumentNullException(nameof(clientId));
     }
     SetUpClient(clientId, tag, deviceId, signatureFactory);
 }
Пример #2
0
        private void SetUpClient(string clientId,
                                 string tag,
                                 string deviceId,
                                 ILCIMSignatureFactory signatureFactory)
        {
            Id               = clientId;
            Tag              = tag;
            DeviceId         = deviceId;
            SignatureFactory = signatureFactory;

            ConversationDict = new Dictionary <string, LCIMConversation>();

            // 模块
            SessionController      = new LCIMSessionController(this);
            ConversationController = new LCIMConversationController(this);
            MessageController      = new LCIMMessageController(this);
        }
Пример #3
0
 /// <summary>
 /// Constructs a LCIMClient with a LCUser.
 /// </summary>
 /// <param name="user"></param>
 /// <param name="tag"></param>
 /// <param name="deviceId"></param>
 /// <param name="signatureFactory"></param>
 public LCIMClient(LCUser user,
                   string tag      = null,
                   string deviceId = null,
                   ILCIMSignatureFactory signatureFactory = null)
 {
     if (user == null)
     {
         throw new ArgumentNullException(nameof(user));
     }
     if (string.IsNullOrEmpty(user.ObjectId) ||
         string.IsNullOrEmpty(user.SessionToken))
     {
         throw new ArgumentException("User must be authenticacted.");
     }
     SetUpClient(user.ObjectId, tag, deviceId, signatureFactory);
     SessionToken = user.SessionToken;
 }