Пример #1
0
        async Task DiscoverCore()
        {
            Discovery discovery = new Discovery(textIpAddress.Text, 1000, _loggerFactory.CreateLogger("Discovery"));
            var       coreList  = await discovery.QueryServiceId((res) => {
                if (res.CoreName == textRoonCoreName.Text)
                {
                    _core = res;
                    return(true);
                }
                return(false);
            });

            if (_core == null)
            {
                if (coreList.Count == 1)
                {
                    _core = coreList[0];
                    textRoonCoreName.Text = _core.CoreName;
                }
                else
                {
                    string corenames = string.Join(", ", coreList.Select((s) => s.CoreName));
                    MessageBox.Show($"Enter name of Roon core [{corenames}] and restart");
                    return;
                }
            }
        }
Пример #2
0
        async Task DiscoverCore(string coreName = null)
        {
            Discovery discovery = new Discovery(_myIpAddress, 10000, _loggerFactory.CreateLogger("Discovery"));
            var       coreList  = await discovery.QueryServiceId((res) => {
                if (coreName != null && res.CoreName == coreName)
                {
                    _core = res;
                    return(true);
                }
                return(false);
            });

            if (_core == null)
            {
                if (coreList.Count == 1)
                {
                    _core = coreList[0];
                    //textRoonCoreName.Text = _core.CoreName;
                }
                else
                {
                    string corenames = string.Join(", ", coreList.Select((s) => s.CoreName));
                    throw new Exception("Multiple Roon Cores found");
                }
            }
        }