private void NotificationHandler(object sender, NotificationReceivedEventHandlerArgs args) { foreach (var property in args.Properties) { if (property.Name != "ZoneGroupState") continue; UpdateTopology(property.Value); } }
private void NotificationHandler(object sender, NotificationReceivedEventHandlerArgs args) { foreach (var property in args.Properties) { if (property.Name != "ZoneGroupState") { continue; } UpdateTopology(property.Value); } }
private void HandleRequest(IAsyncResult result) { var listener = (HttpListener) result.AsyncState; // Call EndGetContext to complete the asynchronous operation. var context = listener.EndGetContext(result); var request = context.Request; var reader = XElement.Load(request.InputStream); XNamespace ns = "urn:schemas-upnp-org:event-1-0"; var args = new NotificationReceivedEventHandlerArgs { Properties = reader.Elements(ns + "property").Select(GetProperty).ToList() }; NotificationReceived.Invoke(this, args); // Obtain a response object. var response = context.Response; response.OutputStream.Close(); listener.BeginGetContext(HandleRequest, listener); }
private void HandleRequest(IAsyncResult result) { var listener = (HttpListener)result.AsyncState; // Call EndGetContext to complete the asynchronous operation. var context = listener.EndGetContext(result); var request = context.Request; var reader = XElement.Load(request.InputStream); XNamespace ns = "urn:schemas-upnp-org:event-1-0"; var args = new NotificationReceivedEventHandlerArgs { Properties = reader.Elements(ns + "property").Select(GetProperty).ToList() }; NotificationReceived.Invoke(this, args); // Obtain a response object. var response = context.Response; response.OutputStream.Close(); listener.BeginGetContext(HandleRequest, listener); }