Example #1
0
        public MainPage()
        {
            this.InitializeComponent();

            devices = new ObservableCollection <InternetRadioDeviceRegistrationInfo>();
            this.AvailableRadios.ItemsSource = devices;

            alljoynBusAttachment = new AllJoynBusAttachment();

            radioWatcher = new InternetRadioWatcher(alljoynBusAttachment);

            radioWatcher.Added += RadioWatcher_Added;
            radioWatcher.Start();
        }
        public MainPage()
        {
            this.InitializeComponent();

            devices = new ObservableCollection<InternetRadioDeviceRegistrationInfo>();
            this.AvailableRadios.ItemsSource = devices;

            alljoynBusAttachment = new AllJoynBusAttachment();
            
            radioWatcher = new InternetRadioWatcher(alljoynBusAttachment);
            
            radioWatcher.Added += RadioWatcher_Added;
            radioWatcher.Start();
        }
Example #3
0
        private async void RadioWatcher_Added(InternetRadioWatcher sender, AllJoynServiceInfo args)
        {
            Debug.WriteLine(args.UniqueName);

            var about = await AllJoynAboutDataView.GetDataBySessionPortAsync(args.UniqueName, alljoynBusAttachment, args.SessionPort);

            if (null == about)
            {
                Debug.WriteLine("Unable to get AboutData for device: " + args.UniqueName);
                return;
            }

            await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, (() =>
            {
                devices.Add(new InternetRadioDeviceRegistrationInfo()
                {
                    Name = string.Format("{0} ({1})", about.AppName, about.DeviceName),
                    sender = sender,
                    args = args
                });
            }));
        }
        private async void RadioWatcher_Added(InternetRadioWatcher sender, AllJoynServiceInfo args)
        {
            Debug.WriteLine(args.UniqueName);

            var about = await AllJoynAboutDataView.GetDataBySessionPortAsync(args.UniqueName, alljoynBusAttachment, args.SessionPort);

            if (null == about)
            {
                Debug.WriteLine("Unable to get AboutData for device: " + args.UniqueName);
                return;
            }

            await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, (() =>
             {
                 devices.Add(new InternetRadioDeviceRegistrationInfo()
                 {
                     Name = string.Format("{0} ({1})", about.AppName, about.DeviceName),
                     sender = sender,
                     args = args
                 });
             }));
        }