wint100
asked on
Read number of Images in silverlight project
I'm using SL4 with a slideshow control to flick between image resources in the client app.
Currently my ViewModel has the code below, which loads the Images and the List is bound to the View. You can see in the code a Value of 6, which is the number of Images in the 'info1' folder. What I need to do is make this more dynamic, to allow more files to be added, without having to modify the code.
So, is there a way to count the number of resources in a project folder (info1 in this case)? I need this to be able to fire an event, when the view has been through all of the images, but that is really a seperate issue.
Would it be better to load the files from the Server, rather than from client resources? Or even load from a ZIP files, and count the number of files in the ZIP folder?
Any help appreciated.
Thanks
Currently my ViewModel has the code below, which loads the Images and the List is bound to the View. You can see in the code a Value of 6, which is the number of Images in the 'info1' folder. What I need to do is make this more dynamic, to allow more files to be added, without having to modify the code.
So, is there a way to count the number of resources in a project folder (info1 in this case)? I need this to be able to fire an event, when the view has been through all of the images, but that is really a seperate issue.
Would it be better to load the files from the Server, rather than from client resources? Or even load from a ZIP files, and count the number of files in the ZIP folder?
Any help appreciated.
Thanks
try
{
for (int i = 0; i < 6; i++)
{
string fileNumber = (i + 1).ToString();
//if (i < 9)
//{
// fileNumber = "0" + fileNumber;
//}
src = new Uri(@"/EnergyViewerV2;component/Images/infoImages/info1/officeEquip_Page_" + fileNumber + ".jpg", UriKind.RelativeOrAbsolute);
image = new BitmapImage(src);
imageList.Add(new Image() { Source = image });
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Data Display", MessageBoxButton.OKCancel);
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
All seems to work well.