示例#1
0
        private void OnFindCompleted(object sender, FindCompletedEventArgs e)
        {
            if (e.Cancelled)
            {
                this.ShowStatus("Discovery cancelled");
            }
            else if (e.Error != null)
            {
                this.discoveryClient.Close();
                MessageBox.Show(
                    e.Error.Message,
                    this.Text,
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information,
                    MessageBoxDefaultButton.Button1,
                    (MessageBoxOptions)0);
            }
            else
            {
                if (this.discoveryClient.InnerChannel.State == CommunicationState.Opened)
                {
                    this.discoveryClient.Close();
                }
            }

            this.discoveryClient = null;
            this.ShowDiscoveryInProgress(false);
        }
 void OnFindCompleted(FindCompletedEventArgs args)
 {
     if (FindCompleted != null)
     {
         FindCompleted(this, args);
     }
 }
 void OnFindCompleted(object sender, FindCompletedEventArgs e)
 {
     lock (this.thisLock)
     {
         if (!this.discoveryCompleted)
         {
             if (e.Error != null ||
                 e.Cancelled ||
                 this.totalDiscoveredEndpoints == e.Result.Endpoints.Count)
             {
                 this.exception          = e.Error;
                 this.discoveryCompleted = true;
                 this.discoveredEndpoints.Shutdown();
             }
             else
             {
                 this.totalExpectedEndpoints = e.Result.Endpoints.Count;
             }
         }
     }
 }
示例#4
0
        void FindCompleted(object sender, FindCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                throw e.Error;
            }

            try
            {
                // Ensures that all FindProgressedChanged events are raised before completing the
                // AsyncResult. If there are pending FindProgressedChanged events to be raised, then
                // the AsyncResult will be completed in the FindProgressedChanged method after all
                // events are raised.
                if (Interlocked.Add(ref pendingEndpointCount, -e.Result.Endpoints.Count) == 0)
                {
                    this.Complete(false);
                }
            }
            catch (Exception exception)
            {
                this.Complete(false, exception);
            }
        }
示例#5
0
 void WSBrowserFindCompleted(object sender, FindCompletedEventArgs e)
 {
     OnDiscoveryFinished(new DiscoveryEventArgs());
 }
示例#6
0
 void SubscriptionFindCompleted(object sender, FindCompletedEventArgs e)
 {
     // If we didn't find any endpoints -- the discovery failed
     if (e.Result.Endpoints.Count > 0)
     {
         subscriptionAddr = e.Result.Endpoints[0].Address;
         DiscoveredCommonOps();
     }
     else
     {
         statusWriter.WriteLine("Discovery Failed");
     }
 }
		private static void DiscoveryClientOnFindCompleted(object sender, FindCompletedEventArgs findCompletedEventArgs)
		{
			var disposable = sender as IDisposable;
			if (disposable != null)
				disposable.Dispose();
		}
 private void OnFindCompleted(object sender, FindCompletedEventArgs e)
 {
     if (!e.Cancelled && !stopped)
     {
         if (e.Error != null)
         {
             log.Warning("Discovery client got faulted");
             discoveryClient.Close();
             discoveryClient = GetInitilizedDisoveryClient();
         }
         else
         {
             log.Info("Discovery client finished. Restarting...");
         }
         discoveryClient.FindAsync(findCriteria);
     }
 }
示例#9
0
 static void ClientFindCompleted(object sender, FindCompletedEventArgs e)
 {
     // Implement this method to access the FindResponse object through e.Result, which includes all the endpoints found
 }
示例#10
0
		void OnFindCompleted (FindCompletedEventArgs args)
		{
			if (FindCompleted != null)
				FindCompleted (this, args);
		}