示例#1
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;
        }
示例#2
0
 private void MainPage_Loaded(object sender, RoutedEventArgs e)
 {
     HostIPAddressTextBlock.Text = GetThisIPAddress();
     _subscriber = new Subscriber();
 }