У меня возникли проблемы с отображением моего сохраненного имени USB Audio Adapter на textblock
, когда я загружаю его из ApplicationDataContainer
, при выборе из listbox
, deviceId
можетдля правильного отображения на textblock
private void audioRenderList_P_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
mediaPlayer_CH1.AudioDevice = renderDeviceList_P[audioRenderList_P.SelectedIndex];
renderDeviceName_P.Text = renderDeviceList_P[audioRenderList_P.SelectedIndex].Name.ToString();
}
if (mediaPlayer_CH1.AudioDevice.Id != null)
{
Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
Windows.Storage.StorageFolder localFolder = Windows.Storage.ApplicationData.Current.LocalFolder;
localSettings.Values["audioRenderSettings_P"] = mediaPlayer_CH1.AudioDevice.Id;
}
![enter image description here](https://i.stack.imgur.com/r2cQF.png)
Однако при загрузке сохраненного аудио deviceId
оно не может отображаться какчитаемые символы;
Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
Windows.Storage.StorageFolder localFolder = Windows.Storage.ApplicationData.Current.LocalFolder;
if (localSettings.Values["audioRenderSettings_P"] != null)
{
var audioSource = localSettings.Values["audioRenderSettings_P"] as string;
mediaPlayer_CH1.AudioDevice = await DeviceInformation.CreateFromIdAsync(audioSource);
renderDeviceName_P.Text = audioSource;
}
else renderDeviceName_P.Text = "Select Audio Device ..";
![enter image description here](https://i.stack.imgur.com/vFrbx.png)
Пожалуйста, помогите.Спасибо.