コード例 #1
0
ファイル: MainPage.xaml.cs プロジェクト: parnic/samsungremote
        private async Task ConditionalFindDevices()
        {
            bool bConnectedToNonCellNetwork = false;
            var  profiles = Windows.Networking.Connectivity.NetworkInformation.GetConnectionProfiles();

            foreach (var profile in profiles)
            {
                if (profile != null &&
                    (profile.IsWlanConnectionProfile || profile.NetworkAdapter.IanaInterfaceType == IanaInterfaceType_Ethernet || profile.NetworkAdapter.IanaInterfaceType == IanaInterfaceType_WiFi))
                {
                    bConnectedToNonCellNetwork = true;
                    break;
                }
            }

            ToggleProgressBar(true);

            if (bConnectedToNonCellNetwork)
            {
                bEnabled = true;
                discoverer.FindTvs();
            }
            else
            {
                SetProgressText("Remote disabled.");
                btnDemoMode.Visibility        = Visibility.Visible;
                TransparentOverlay.Visibility = Visibility.Visible;

                await DisplayOkBox("You must be connected to a non-cell network in order to connect to a TV. Connect to the same network as your device and try again.");
            }
        }