/// <summary> /// Called when [online annoncement]. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="System.ServiceModel.Discovery.AnnouncementEventArgs"/> instance containing the event data.</param> private void OnOnlineAnnoncement(object sender, AnnouncementEventArgs e) { var address = e.EndpointDiscoveryMetadata.Address; Uri uri = address.Uri; if (uri.AbsoluteUri.EndsWith("mex")) { return; } if (uri.Scheme == CHANNEL_TYPE_NAMEPIPE) { AddProxies(() => new NetNamedPipeBinding(), address); } else if (uri.Scheme != CHANNEL_TYPE_NAMEPIPE) { AddProxies(() => new NetTcpBinding(), address); } try { Ping(); } #region Exception Handling catch (Exception ex) { TraceSourceMonitorHelper.Warn("MonitorWcfDiscoveryProxy: ping faild, {0}", ex); } #endregion Exception Handling }
void OnOnlineEvent(object sender, AnnouncementEventArgs e) { ListViewItem item = new ListViewItem(e.EndpointDiscoveryMetadata.Address.ToString()); lvDevices.Items.Add(item); Console.WriteLine("Received an online announcement from {0}", e.EndpointDiscoveryMetadata.Address); }
void UnregisterEndpoint(object obj, AnnouncementEventArgs e) { if (!PushQueueItem(e.MessageSequence)) { return; } endpoints.Remove(e.EndpointDiscoveryMetadata); }
private async void OnOnlineEvent(object sender, AnnouncementEventArgs e) { var state = (_serverAppService as ICommunicationObject).State; if (state != CommunicationState.Opened && state != CommunicationState.Opening) { await Connect(e.EndpointDiscoveryMetadata.Address.Uri.ToString()).ConfigureAwait(false); } }
static void OnOnlineAnnouncementReceived(object sender, AnnouncementEventArgs e) { foreach (var wContractType in e.EndpointDiscoveryMetadata.ContractTypeNames) { if (_discoverers.TryGetValue(wContractType.Name, out var resolver)) { resolver.OnServiceOnlineAnnouncementReceived(e.EndpointDiscoveryMetadata); } } }
void OnHello(object sender, AnnouncementEventArgs args) { foreach (XmlQualifiedName contract in args.EndpointDiscoveryMetadata.ContractTypeNames) { if (contract.Name == typeof(T).Name && contract.Namespace == Namespace) { PublishNotificationEvent(OnHelloEvent, args.EndpointDiscoveryMetadata.Address.Uri.AbsoluteUri); Dictionary[args.EndpointDiscoveryMetadata.Address] = args.EndpointDiscoveryMetadata.Scopes; } } }
void RegisterEndpoint(object obj, AnnouncementEventArgs e) { if (!PushQueueItem(e.MessageSequence)) { return; } var edm = e.EndpointDiscoveryMetadata; Console.WriteLine("New endpoint: {0} {1} {2}", edm.Address, edm.ContractTypeNames.Count, edm.Scopes.Count); endpoints.Add(e.EndpointDiscoveryMetadata); }
private static void OnOfflineAnnouncement(object sender, AnnouncementEventArgs e) { Console.WriteLine("Bye!"); EndpointDiscoveryMetadata metadata = e.EndpointDiscoveryMetadata; if (metadata != null && metadata.ListenUris.Count > 0 && metadata.ListenUris[0].Equals(endpointAddress.Uri)) { Console.WriteLine("Service said goodbye!!"); endpointAddress = null; hostedEndPoint = null; } }
/// <summary> /// Called when [offline annoncement]. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="System.ServiceModel.Discovery.AnnouncementEventArgs"/> instance containing the event data.</param> private void OnOfflineAnnoncement(object sender, AnnouncementEventArgs e) { var address = e.EndpointDiscoveryMetadata.Address; Uri uri = address.Uri; if (uri.AbsoluteUri.EndsWith("mex")) { return; } Cleanup(uri.AbsolutePath); }
private static void OnOfflineAnnouncement(object sender, AnnouncementEventArgs e) { EndpointDiscoveryMetadata metadata = e.EndpointDiscoveryMetadata; if (metadata.ListenUris.Count > 0 && metadata.ListenUris[0].Equals(endpointAddress.Uri)) { Console.WriteLine("Service said goodbye!!"); endpointAddress = null; accelerationServiceEndPoint = null; deviceInfoServiceEndPoint = null; dataLoggingServiceEndPoint = null; } }
void OnBye(object sender, AnnouncementEventArgs args) { foreach (XmlQualifiedName contract in args.EndpointDiscoveryMetadata.ContractTypeNames) { if (contract.Name == typeof(T).Name && contract.Namespace == Namespace) { PublishNotificationEvent(OnByeEvent, args.EndpointDiscoveryMetadata.Address.Uri.AbsoluteUri); Debug.Assert(Dictionary.ContainsKey(args.EndpointDiscoveryMetadata.Address)); Dictionary.Remove(args.EndpointDiscoveryMetadata.Address); } } }
protected void OnHello(object sender, AnnouncementEventArgs args) { if (Dictionary.ContainsKey(args.EndpointDiscoveryMetadata.Address)) { return; } foreach (XmlQualifiedName contract in args.EndpointDiscoveryMetadata.ContractTypeNames) { if (contract.Name == typeof(T).Name && contract.Namespace == Namespace) { Dictionary[args.EndpointDiscoveryMetadata.Address] = args.EndpointDiscoveryMetadata.Scopes.ToArray(); PublishAvailabilityEvent(OnlineAnnouncementReceived, args.EndpointDiscoveryMetadata.Address.Uri.AbsoluteUri, args.EndpointDiscoveryMetadata.Scopes.ToArray()); } } }
private void OnOfflineAnnouncement(object sender, AnnouncementEventArgs e) { EndpointDiscoveryMetadata metadata = e.EndpointDiscoveryMetadata; FindCriteria criteria = new FindCriteria(typeof(T)); if (criteria.IsMatch(metadata)) { // 指定类型的服务下线 if (cache.Contains(metadata.Address.Uri)) { cache.Remove(metadata); Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "Announcement endpoint offline : {0} - {1}", metadata.GetSpecifiedName(), metadata.Address.Uri)); } } }
private static void OnOfflineAnnouncement(object sender, AnnouncementEventArgs e) { Console.WriteLine("Bye!"); EndpointDiscoveryMetadata metadata = e.EndpointDiscoveryMetadata; if (metadata != null && metadata.ListenUris.Count > 0) { foreach (edu.teco.DPWS.Device device in knownDevices) { if (device.EndpointAddress.Uri.Equals(metadata.ListenUris[0])) { knownDevices.Remove(device); Console.WriteLine("Device removed {0}:{1} at {2}", device.GetDeviceType().Namespace, device.GetDeviceType().Name, metadata.ListenUris[0]); break; } } } }
private static void OnOnlineAnnouncement(object sender, AnnouncementEventArgs e) { EndpointDiscoveryMetadata metadata = e.EndpointDiscoveryMetadata; // Check if service is SSimpDeviceType which is the Host service used foreach (System.Xml.XmlQualifiedName type in metadata.ContractTypeNames) { if (type.Equals(new System.Xml.XmlQualifiedName("AccelerationDeviceType", "http://www.teco.edu/AccelerationService"))) { Console.WriteLine("New service found: !!"); AnnouncementFound = true; endpointAddress = new EndpointAddress(metadata.ListenUris[0]); GetServiceEndPoints(endpointAddress); Console.WriteLine("Service can now be invoked"); } } }
protected void OnBye(object sender, AnnouncementEventArgs args) { if (Dictionary.ContainsKey(args.EndpointDiscoveryMetadata.Address)) { Dictionary.Remove(args.EndpointDiscoveryMetadata.Address); } foreach (XmlQualifiedName contract in args.EndpointDiscoveryMetadata.ContractTypeNames) { if (contract.Name == typeof(T).Name && contract.Namespace == Namespace) { PublishAvailabilityEvent(OfflineAnnouncementReceived, args.EndpointDiscoveryMetadata.Address.Uri.AbsoluteUri, args.EndpointDiscoveryMetadata.Scopes.ToArray()); if (Dictionary.ContainsKey(args.EndpointDiscoveryMetadata.Address) == false) { Trace.WriteLine("Received 'bye' announcement that did not have matching 'hello' first from address " + args.EndpointDiscoveryMetadata.Address.Uri.AbsoluteUri); } } } }
void OnOfflineEvent(object sender, AnnouncementEventArgs e) { string addr = e.EndpointDiscoveryMetadata.Address.ToString(); List <ListViewItem> items = new List <ListViewItem>(); foreach (ListViewItem item in lvDevices.Items) { if (item.Text == addr) { items.Add(item); } } foreach (ListViewItem item in items) { lvDevices.Items.Remove(item); } Console.WriteLine("Received an offline announcement from {0}", e.EndpointDiscoveryMetadata.Address); }
private static void OnOnlineAnnouncement(object sender, AnnouncementEventArgs e) { Console.WriteLine("Hello!"); EndpointDiscoveryMetadata metadata = e.EndpointDiscoveryMetadata; // Check if service is SSimpDeviceType which is the Host service used foreach (System.Xml.XmlQualifiedName type in metadata.ContractTypeNames) { foreach (System.Xml.XmlQualifiedName name in deviceTypes.Keys) { if (type.Equals(name)) { Console.WriteLine("New device found: {0}:{1} at {2}", name.Namespace, name.Name, metadata.ListenUris[0]); edu.teco.DPWS.Device device = (edu.teco.DPWS.Device)Activator.CreateInstance(deviceTypes[name]); device.EndpointAddress = new EndpointAddress(metadata.ListenUris[0]); GetMetaData(device); device.Init(); knownDevices.Add(device); Console.WriteLine("Service can now be invoked"); break; } } } }
static void OnOfflineEvent(object sender, AnnouncementEventArgs e) { Console.WriteLine(); Console.WriteLine("Received an offline announcement from {0}:", e.EndpointDiscoveryMetadata.Address); PrintEndpointDiscoveryMetadata(e.EndpointDiscoveryMetadata); }
static void OnlineAnnouncementReceived(object sender, AnnouncementEventArgs e) { CarRentalEndpoint = e.EndpointDiscoveryMetadata.Address.Uri.AbsoluteUri; }
private void OnOnlineEvent(object sender, AnnouncementEventArgs e) { _availableEndpoints.Add(e.EndpointDiscoveryMetadata.Address); AvailableEndpointsChanged?.Invoke(this, new EventArgs()); }
private static void AnnouncementSrvOfflineAnnouncementReceived(object sender, AnnouncementEventArgs args) { var uris = args?.EndpointDiscoveryMetadata?.ListenUris; if (uris == null) { return; } foreach (var uri in uris) { if (uri != null) { RemoveDevice(uri.ToString()); } } }
private static void Announcement_srv_OnlineAnnouncementReceived(object sender, AnnouncementEventArgs args) { CheckDevice(args.EndpointDiscoveryMetadata); }
void IServiceBusAnnouncements.OnHello(Uri address, string contractName, string contractNamespace, Uri[] scopes) { AnnouncementEventArgs args = DiscoveryHelper.CreateAnnouncementArgs(address, contractName, contractNamespace, scopes); OnHello(this, args); }
private async void OnOfflineEvent(object sender, AnnouncementEventArgs e) { SetState(ClientState.Initializing); await Connect(e.EndpointDiscoveryMetadata.Address.Uri.ToString()).ConfigureAwait(false); }
private static void AnnouncementService_OnlineAnnouncementReceived(object sender, AnnouncementEventArgs e) { Console.WriteLine("online"); Console.WriteLine(e.EndpointDiscoveryMetadata.Address.Uri); Console.WriteLine(e.EndpointDiscoveryMetadata.ContractTypeNames[0].Name); }
static void OfflineAnnouncementReceived(object sender, AnnouncementEventArgs e) { CarRentalEndpoint = ""; }
void m_DiscoveryClient_ProxyAvailable(object sender, AnnouncementEventArgs e) { DiscoveryManaged(e.EndpointDiscoveryMetadata.Address.Uri.AbsoluteUri); }
static void announcementService_OnlineAnnouncementReceived(object sender, AnnouncementEventArgs e) { Console.WriteLine("Received Online Announcement from {0}", e.EndpointDiscoveryMetadata.Address); }