public void Handle(AccountAddedMessage message)
        {
            _log.InfoFormat("Adding account {0}", message.AccountName);
            var accountInfo = _collection.GetOrCreate(new AccountName(message.AccountName));
            var account     = PluginInfoSender.CreatePluginAccount(
                _context.PluginName,
                accountInfo.Name,
                accountInfo.Profiles.Select(profile => new PluginProfile(profile.Name)).ToArray());

            var pluginAccountMessage = new PluginAccountMessageSerialized
            {
                SerializedMessage = new[] { account }.Serialize()
            };

            _bus.Send(pluginAccountMessage);
        }
示例#2
0
        public bool NeedToHandleMessage(MessageEx message)
        {
            if (_accountCollection.GetOrCreate(message.AccountTag).Profiles.Any())
            {
                return(true);
            }
            var conditionalMessageRouter = ObjectFactory.TryGetInstance <ITargetProcessConditionalMessageRouter>();

            return(conditionalMessageRouter != null && conditionalMessageRouter.Handle(message));
        }
 protected IAccount GetAccount()
 {
     return(_accountCollection.GetOrCreate(_args.AccountName));
 }