private async void btnGetUICC_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var modem = MobileBroadbandModem.GetDefault();
                MobileBroadbandModemConfiguration modemCfg = await modem.GetCurrentConfigurationAsync();

                MobileBroadbandUicc uicc = modemCfg.Uicc;
                if (uicc != null)
                {
                    StringBuilder sb = new StringBuilder();
                    sb.AppendLine("SIM Card ICCID:" + uicc.SimIccId);

                    sb.AppendLine("Application on SIM Card");
                    MobileBroadbandUiccAppsResult appsResult = await uicc.GetUiccAppsAsync();

                    foreach (var uiccApp in appsResult.UiccApps)
                    {
                        sb.AppendLine("Kind: " + uiccApp.Kind);
                    }
                    txtSIMInformation.Text = sb.ToString();
                }
            }
            catch (Exception ex)
            {
                rootPage.NotifyUser("Error:" + ex.Message, NotifyType.ErrorMessage);
            }
        }
Example #2
0
        private async void btnGetUICC_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var modem = MobileBroadbandModem.GetDefault();
                MobileBroadbandModemConfiguration modemCfg = await modem.GetCurrentConfigurationAsync();

                MobileBroadbandUicc uicc = modemCfg.Uicc;
                if (uicc != null)
                {
                    StringBuilder sb = new StringBuilder();
                    sb.AppendLine("SIM Card ICCID:" + uicc.SimIccId);


                    MobileBroadbandUiccAppsResult appsResult = await uicc.GetUiccAppsAsync();

                    System.Collections.ObjectModel.ObservableCollection <object> AppList = new System.Collections.ObjectModel.ObservableCollection <object>();
                    foreach (var uiccApp in appsResult.UiccApps)
                    {
                        ListBoxItem item = new ListBoxItem();
                        item.Name    = uiccApp.Kind.ToString();
                        item.Content = uiccApp;
                        AppList.Add(item);
                    }

                    listUiccApps.ItemsSource = AppList;
                    if (AppList.Count > 0)
                    {
                        listUiccApps.SelectedIndex = 0;
                    }
                    else
                    {
                        sb.AppendLine("No UICC app found.");
                    }

                    txtUICCInformation.Text = sb.ToString();
                }
            }
            catch (Exception ex)
            {
                rootPage.NotifyUser("Error:" + ex.Message, NotifyType.ErrorMessage);
            }
        }