/// <inheritdoc /> public void RegisterHandler(ICommHandler handler) { if (this.handler != null) { throw new InvalidOperationException("RegisterHandler already called!"); } this.handler = handler ?? throw new ArgumentNullException(nameof(handler)); }
/// <summary> /// Constructs an instance of Core /// Registers handlers to catch ChatMessage events /// </summary> /// <param name="comm">CommHandler object to register with</param> public Core(ICommHandler comm) { CommHandler = comm; IAPIHandler = new IAPI(); MessageQueue = new Queue<ChatMessage>(); if (comm != null) { CommHandler.CoreListener += new ChatEventHandler(MessageHandler); } }
/// <summary> /// Constructs an instance of Core /// Registers handlers to catch ChatMessage events /// </summary> /// <param name="comm">CommHandler object to register with</param> public Core(ICommHandler comm) { _commHandler = comm; _messageQueue = new Queue<ChatMessage>(); if (comm != null) { _commHandler.CoreListener += MessageHandler; } CloudStorageAccount storageAccount = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("StorageConnectionString")); CloudTableClient queueClient = storageAccount.CreateCloudTableClient(); _messageTable = queueClient.GetTableReference("chatMessages"); _messageTable.CreateIfNotExists(); }