コード例 #1
0
ファイル: MainForm.cs プロジェクト: tnaidenov/net-examples
        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}");
            }
        }
コード例 #2
0
        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);
        }
コード例 #3
0
ファイル: MainForm.cs プロジェクト: tnaidenov/net-examples
        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);
                }
            });
        }
コード例 #4
0
ファイル: MainForm.cs プロジェクト: tnaidenov/net-examples
        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);
            }
        }
コード例 #5
0
ファイル: MainForm.cs プロジェクト: tnaidenov/net-examples
 private void RemoveTarget(InteropEndpointStatusChangedEventArgs args)
 {
     targets_.Items.RemoveByKey(args.InteropEndpoint.OriginalServer.InstanceId);
 }