Esempio n. 1
0
        private void ConnectButton_Click(object sender, RoutedEventArgs e)
        {
            string host = HostNameTextBox.Text;
            string name = SpeakerNameTextBox.Text;

            _subscriber.ConnectAsync(host, name);
        }
Esempio n. 2
0
        private async void MainPage_LoadedAsync(object sender, RoutedEventArgs e)
        {
            //get the current IP address of this machine and display it
            HostIPAddressTextBlock.Text = GetThisIPAddress();
            //set up as a publisher and bind the UI to the list of virtual speakers
            _publisher = new Publisher();
            MessageLogListView.ItemsSource = _publisher.Speakers;
            bool init = await _publisher.Initialize();

            if (init)
            {
                //allow a new media file to be selected
                SelectMediaFileButton.IsEnabled = true;
                // create a virtual speaker for this local machine to listen to the music we send
                _subscriber = new Subscriber();
                //hardcoded to localhost and name for local speaker
                _subscriber.ConnectAsync("localhost", "Host Speaker");
            }
            else
            {
                Debug.WriteLine("Error: Publisher failed to initialize");
            }
            // listen for changes in the collection of virtual speakers
            _publisher.Speakers.CollectionChanged += Speakers_CollectionChanged;
        }