// 触发消息通知事件
        public virtual void TriggerAddMessage(MessageConnection connection,
                                              AddMessageEventArgs e)
        {
            AddMessageEventHandler handler = this.AddMessage;

            if (handler != null)
            {
                handler(connection, e);
            }
        }
Пример #2
0
        private void _connection_AddMessage(object sender,
                                            DigitalPlatform.MessageClient.AddMessageEventArgs e)
        {
            if (e.Records != null)
            {
                foreach (var record in e.Records)
                {
                    Console.WriteLine($"message sender:{record.creator}, userName:{record.userName}, groups:{string.Join(",", record.groups)}, data:{record.data}");
                }

                Task.Run(async() =>
                {
                    await ProcessAndReply(e.Records);
                });
            }
        }