Exemple #1
0
        public void SendConfiguration(ConfigurationParams parameters, IConfigurationCallback callbacks, double timeoutMs)
        {
            Guid queryId = System.Guid.NewGuid();

            this.SendConfiguration(parameters, queryId.ToString(), callbacks, timeoutMs);
        }
Exemple #2
0
        public void SendConfiguration(ConfigurationParams parameters, string queryId, IConfigurationCallback callbacks, double timeoutMs)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException("parameters");
            }

            if (callbacks == null)
            {
                throw new ArgumentNullException("callbacks");
            }

            if (timeoutMs <= 0)
            {
                throw new ArgumentException("timeout");
            }

            if (string.IsNullOrEmpty(queryId))
            {
                throw new ArgumentException("queryId");
            }

            ConfigurationRequest request = new ConfigurationRequest(parameters, queryId);
            ConfigurationTimer   timer   = new ConfigurationTimer(timeoutMs, request);
            ConfigQuery          query   = new ConfigQuery(request, callbacks, timer);

            lock (this.awaitingResponses)
            {
                this.awaitingResponses.Add(queryId, query);
                timer.AutoReset = false;
                timer.Elapsed  += new ElapsedEventHandler(this.OnTimedEvent);
                timer.Start();
            }

            this.sender.SendMessage(this.serializer.Serialize(request));
        }
Exemple #3
0
 internal ConfigQuery(ConfigurationRequest request, IConfigurationCallback callbacks, ConfigurationTimer timer)
 {
     this.Request   = request;
     this.Callbacks = callbacks;
     this.Timer     = timer;
 }