public override void Update(IPropertyBag config, IPropertyBag bizTalkConfig, IPropertyBag handlerPropertyBag)
 {
     lock (this)
     {
         if (this.taskController.State != State.Running)
         {
             if (config != null)
             {
                 lock (this)
                 {
                     object property = null;
                     config.Read("AdapterConfig", out property, 0);
                     if (property != null)
                     {
                         XmlDocument document = new XmlDocument();
                         document.LoadXml((string)property);
                         this.adapterConfiguration.Load(document);
                     }
                     this.taskController.Schedule = this.adapterConfiguration.Schedule;
                     transportProxy.SetErrorInfo(new ScheduledException(string.Format("\r\n{0}:  scheduled activation changed to  {1}", this.adapterConfiguration.Name, this.adapterConfiguration.Schedule.GetNextActivationTime())));
                 }
             }
         }
     }
 }
 public override void Update(IPropertyBag config, IPropertyBag bizTalkConfig, IPropertyBag handlerPropertyBag)
 {
     lock (this)
     {
         if (this.taskController.State != State.Running)
         {
             if (config != null)
             {
                 XmlDocument updatedConfigDom = ConfigProperties.ExtractConfigDom(config);
                 lock (this)
                 {
                     this.properties.LocationConfiguration(updatedConfigDom);
                     this.taskController.Schedule = this.properties.Schedule;
                     transportProxy.SetErrorInfo(new ScheduledException("\r\n" + this.properties.Name + ":  scheduled activation changed to  " + this.properties.Schedule.GetNextActivationTime().ToString()));
                 }
             }
         }
     }
 }
        public void Done(IBTDTCCommitConfirm commitConfirm)
        {
            if (_messages.Count == 0)
            {
                Exception ex = new InvalidOperationException("Send adapter received an emtpy batch for transmission from BizTalk");
                _transportProxy.SetErrorInfo(ex);

                return;
            }

            //  The Enter/Leave is used to implement the Terminate call from BizTalk.

            //  Do an "Enter" for every message
            int messageCount = _messages.Count;

            for (int i = 0; i < messageCount; i++)
            {
                if (!_asyncTransmitter.Enter())
                {
                    throw new InvalidOperationException("Send adapter Enter call was false within Done. This is illegal and should never happen.");
                }
            }

            try
            {
                new WorkerDelegate(Worker).BeginInvoke(null, null);
            }
            catch (Exception)
            {
                //  If there was an error we had better do the "Leave" here
                for (int i = 0; i < messageCount; i++)
                {
                    _asyncTransmitter.Leave();
                }
            }
        }