private void InteropEndpointStatusChanged(object sender, InteropEndpointStatusChangedEventArgs e) { if (string.Equals(e.InteropEndpoint.Definition.Name, _chatEndpointName, StringComparison.CurrentCultureIgnoreCase)) { string status = e.InteropEndpoint.IsValid ? "+++ Discovered" : "--- Disappeared"; Log($"{status} duplex chat instance {e.InteropEndpoint.OriginalServer}"); } }
private void InteropEndpointStatusChanged(object sender, InteropEndpointStatusChangedEventArgs e) { // is this an instance of the demo stream? var endpoint = e.InteropEndpoint; // filter only streaming endpoints called GlueDemoTickStream if (endpoint.Definition.Name != "GlueDemoTickStream" || !endpoint.Definition.Flags.HasFlag(MethodFlags.SupportsStreaming) || !endpoint.IsValid) { return; } _ticksEndpoint = endpoint; var symbol = ComboBoxSymbols.SelectedItem.ToString(); SubscribeStream(symbol); }
private void AddTarget(InteropEndpointStatusChangedEventArgs args) { ListViewItem item = null; instanceProps_.Each(p => { IInstance target = args.InteropEndpoint.OriginalServer; string text = p.GetValue(target)?.ToString(); if (item == null) { item = targets_.Items.Add(target.InstanceId, text, -1); item.Tag = target; } else { item.SubItems.Add(text); } }); }
private void InteropEndpointStatusChanged(object sender, InteropEndpointStatusChangedEventArgs e) { // we can just interact with the ui since we have specified synchronization context if (!string.Equals(e.InteropEndpoint.Definition.Name, endpointName_, StringComparison.CurrentCultureIgnoreCase)) { // ignore non-interesting endpoints return; } bool activated = e.InteropEndpoint.IsValid; string status = activated ? "+++ Discovered" : "--- Disappeared"; Log($"{status} advanced instance {e.InteropEndpoint.OriginalServer}"); if (activated) { AddTarget(e); } else { RemoveTarget(e); } }
private void RemoveTarget(InteropEndpointStatusChangedEventArgs args) { targets_.Items.RemoveByKey(args.InteropEndpoint.OriginalServer.InstanceId); }