コード例 #1
0
        public void Handle(ITargetProcessMessage message)
        {
            if (_pluginContext.ProfileName.IsEmpty)
            {
                if (!_profileCollection.Any())
                {
                    var singleProfileProvider = ObjectFactory.TryGetInstance <ITargetProcessMessageWhenNoProfilesHandler>();
                    if (singleProfileProvider != null)
                    {
                        singleProfileProvider.Handle(message);
                    }
                }

                DispatchToProfiles(message, (x, y) => x.Send(y));
            }
        }
コード例 #2
0
        protected override PluginCommandResponseMessage OnExecute(PluginProfileDto profileDto)
        {
            NormalizeProfile(profileDto);

            ITargetProcessMessage message;

            if (_profileCollection.Any(x => x.Name == profileDto.Name))
            {
                UpdatePluginProfile(profileDto);
                message = new ProfileUpdatedMessage();
            }
            else
            {
                AddPluginProfile(profileDto);
                message = new ProfileAddedMessage();
            }

            SendProfileChangedLocalMessage(profileDto.Name, message);

            return(new PluginCommandResponseMessage
            {
                ResponseData = string.Empty, PluginCommandStatus = PluginCommandStatus.Succeed
            });
        }