Пример #1
0
        protected async Task Listen(TcpListener listener)
        {
            try
            {
                //MoleClientCore core = CreateCore();
                var tasks = new List <Task>();
                while (true)
                {
                    if (CancellationTokenSource.IsCancellationRequested)
                    {
                        return;
                    }
                    ReadyToAcceptClient = true;
                    var client = await listener.AcceptTcpClientAsync().ConfigureAwait(false);

                    var reciever = new MoleClientReceiver(client, Core, ServerSender);
                    Recievers.Add(reciever);
                    tasks.Add(reciever.RunAsync(CancellationTokenSource.Token));
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        private void FillRecievers()
        {
            var names = WinSound.GetRecordingNames();

            foreach (var item in names.Select(name => new ComboBoxItem
            {
                Content = name,
            }))
            {
                item.Selected += SelecterRecieverChanged;
                Recievers.Add(item);
            }

            OnPropertyChanged("Recievers");
        }