I have done all of the things necessary to gaining access to the files located on the SD card of my IOT device (DragonBoard 410c).
I have all of the FileTypeAssociations
<Capability Name="internetClient" />
<Capability Name="privateNetworkClientServer" />
<Capability Name="internetClientServer" />
<uap:Capability Name="userAccountInformation" />
<uap:Capability Name="removableStorage" />
<uap:Capability Name="enterpriseAuthentication" />
I CAN see and iterate over the files on the SD card
StorageFolder removablelDevices = Windows.Storage.KnownFolders.RemovableDevices;
StorageFolder sdCard = (await removablelDevices.GetFoldersAsync()).FirstOrDefault();
var files = await nm.GetFilesAsync();
foreach (var file in files)
{
DebugText(file.Path);
//E:\Photo1.jpg
//E:\Photo2.jpg
}
I am setting the ImageSource of the ImageBrush of the Background to these pictures in a slideshow.
private ImageSource _CurrentPicture;
public ImageSource CurrentPicture { get { return _CurrentPicture; } set { Set(ref _CurrentPicture, value); } }
<ImageBrush Stretch="UniformToFill" ImageSource="{x:Bind ViewModel.CurrentPicture, Mode=OneWay}"/>
The pictures do not show up (E:\Photo1.jpg etc)
I AM able to iterate over fileshares on a local server during development mode, so my pictures do show on my Background in that scenario.
I am updating the background with a DispatchTimer.
Now that file access is async, I am running into async hell.
public void TimerSetup()
{
SlideShowTimer = new DispatcherTimer();
SlideShowTimer.Tick += SlideShowTimer_Tick;
SlideShowTimer.Interval = new TimeSpan(0, 0, SlideShowChangeIntervalSeconds);
SlideShowTimer.Start();
}
void SlideShowTimer_Tick(object sender, object e)
{
ChangeBackground();
}
public async Task ChangeBackground()
{
var nextIndex = RandomGenerator.Next(0, SlideShowFiles.Length);
var fileName = SlideShowFiles[nextIndex];
var file = await StorageFile.GetFileFromPathAsync(fileName);
var stream = await file.OpenAsync(FileAccessMode.Read);
await CurPicImage.SetSourceAsync(stream);
await Task.CompletedTask;
}