示例#1
0
        /// <summary>
        /// Notifies the given discovery listeners about the provided error.
        /// </summary>
        /// <param name="error">The error to notify.</param>
        private void NotifyDiscoveryError(string error)
        {
            logger.ErrorFormat("{0}Error discovering devices: {1}", xbeeDevice, error);

            if (DiscoveryError == null)
            {
                return;
            }

            try
            {
                lock (DiscoveryError)
                {
                    var handler = DiscoveryError;
                    if (handler != null)
                    {
                        var args = new DiscoveryErrorEventArgs(error);

                        handler.GetInvocationList().AsParallel().ForAll((action) =>
                        {
                            action.DynamicInvoke(this, args);
                        });
                    }
                }
            }
            catch (Exception e)
            {
                logger.Error(e.Message, e);
            }
        }
示例#2
0
 /// <summary>
 /// Handles discovery error event
 /// </summary>
 /// <param name="sender">Event sender</param>
 /// <param name="e">Event parameter</param>
 protected void OnDiscoveryError(object sender, DiscoveryErrorEventArgs e)
 {
     if (DiscoveryError != null)
     {
         DiscoveryError(e.Exception);
     }
 }
示例#3
0
 /// <summary>
 /// Handles discovery error event
 /// </summary>
 /// <param name="sender">Event sender</param>
 /// <param name="e">Event parameter</param>
 /// <param name="errors"></param>
 protected void OnDiscoveryError(object sender,
                                 DiscoveryErrorEventArgs e,
                                 List <DiscoveryErrorEventArgs> errors)
 {
     if (errors != null)
     {
         errors.Add(e);
     }
     else
     {
         if (DiscoveryError != null)
         {
             DiscoveryError(e.Exception);
         }
     }
 }
示例#4
0
 /// <summary>
 /// Handles discovery error
 /// </summary>
 /// <param name="sender">Event sender</param>
 /// <param name="e">Event arguments</param>
 protected void OnDiscoveryError(object sender, DiscoveryErrorEventArgs e)
 {
     _error = e.Exception;
     _eventDiscoveryError.Set();
 }
示例#5
0
 /// <summary>
 /// Handles discovery soap fault
 /// </summary>
 /// <param name="sender">Event sender</param>
 /// <param name="e">Event arguments</param>
 protected void OnSoapFault(object sender, DiscoveryErrorEventArgs e)
 {
     _soapFault = e.Fault;
     _eventFaultReceived.Set();
 }