Exemplo n.º 1
0
        /// <summary>
        /// Event handler for arrival of Fx2 devices
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="devInterface">The device interface which was added</param>
        private async void OnFx2Added(Windows.Devices.Enumeration.DeviceWatcher sender, Windows.Devices.Enumeration.DeviceInformation devInterface)
        {
            await
            MainPage.Current.Dispatcher.RunAsync(
                Windows.UI.Core.CoreDispatcherPriority.Normal,
                () =>
            {
                MainPage.Current.NotifyUser(String.Format("OnFx2Added: {0}", devInterface.Id), NotifyType.StatusMessage);

                // search the device list for a device with a matching interface ID
                DeviceListEntry match = FindInList(devInterface.Id);

                // If we found a match then mark it as verified and return
                if (match != null)
                {
                    match.Matched = true;
                    return;
                }


                // Create a new element for this device interface, and queue up the query of its
                // device information
                match = new DeviceListEntry(devInterface);

                // Add the new element to the end of the list of devices
                m_Fx2Devices.Add(match);
            }
                );
        }
        /// <summary>
        /// Event handler for arrival of Fx2 devices
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="devInterface">The device interface which was added</param>
        private async void OnFx2Added(Windows.Devices.Enumeration.DeviceWatcher sender, Windows.Devices.Enumeration.DeviceInformation devInterface)
        {
            await
            MainPage.Current.Dispatcher.RunAsync(
                Windows.UI.Core.CoreDispatcherPriority.Normal,
                () =>
                {
                    MainPage.Current.NotifyUser(String.Format("OnFx2Added: {0}", devInterface.Id), NotifyType.StatusMessage);

                    // search the device list for a device with a matching interface ID
                    DeviceListEntry match = FindInList(devInterface.Id);

                    // If we found a match then mark it as verified and return
                    if (match != null)
                    {
                        match.Matched = true;
                        return;
                    }


                    // Create a new element for this device interface, and queue up the query of its
                    // device information
                    match = new DeviceListEntry(devInterface);

                    // Add the new element to the end of the list of devices
                    m_Fx2Devices.Add(match);
                }
            );
        }