0

I am new to window-8 application development. I want to create a simple javascript photo application. In my application, I want to show an assets folder for users to pick images they choose. Can someone help me with this?

enter image description here

Shouvik
  • 11,350
  • 16
  • 58
  • 89
srini
  • 876
  • 3
  • 12
  • 23

2 Answers2

1

Since you are using JS to construct your app, all you need to do is write up a small script that lists out the path to the assets you have put up in that folder and link it via a HTML page. Are you trying to dynamically do this? I don't think such a solution exists..

Edit: On second thoughts, have you considered using a promise to run the script everytime a new resource is added to the folder? Keep a check on the folder and raise a flag when a resource is added, based on flag status, call the promise to update the script will will contain the newly added resources. You may also need to consider the situation where a user may be selecting data while the promise may update the page. Appropriate use session storage to handle the situation.

Shouvik
  • 11,350
  • 16
  • 58
  • 89
  • Currently I am occupied in other tasks. I will write our a sample code and share it over here over the weekend. It's been a couple of months since I fiddled with win 8 and I will need some time to ride that bike :) – Shouvik Feb 28 '13 at 11:18
0

There is a FilePicker control that lets you easily display images/files for the user to pick. Here is a code sample; download the JavaScript version. There are also guidelines with links to the API documentation here.

An excerpt from the code sample:

// Create the picker object and set options 
var openPicker = new Windows.Storage.Pickers.FileOpenPicker(); 
openPicker.viewMode = Windows.Storage.Pickers.PickerViewMode.thumbnail; 
openPicker.suggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.picturesLibrary; 
// Users expect to have a filtered view of their folders depending on the scenario. 
// For example, when choosing a documents folder, restrict the filetypes to documents for your application. 
openPicker.fileTypeFilter.replaceAll([".png", ".jpg", ".jpeg"]); 

// Open the picker for the user to pick a file 
openPicker.pickSingleFileAsync().then(function (file) { 
   if (file) { 
       // Application now has read/write access to the picked file 
       WinJS.log && WinJS.log("Picked photo: " + file.name, "sample", "status"); 
   } else { 
       // The picker was dismissed with no selected file 
       WinJS.log && WinJS.log("Operation cancelled.", "sample", "status"); 
   } 
}); 
Jennifer Marsman - MSFT
  • 5,167
  • 1
  • 25
  • 24
  • thanks for guide i want to show my assets folders example image here:http://i.stack.imgur.com/7Gd7W.png – srini Feb 19 '13 at 14:41
  • Use the AppBar class to add folder names to the app bar along the bottom, and use the Flyout class to add the images. Here are some quickstart code samples: AppBar - http://msdn.microsoft.com/en-us/library/windows/apps/hh465309.aspx, Flyout - http://msdn.microsoft.com/en-us/library/windows/apps/hh465354.aspx – Jennifer Marsman - MSFT Feb 19 '13 at 15:12
  • So that is *how* you could do it, but you may want to read the AppBar guidelines at http://msdn.microsoft.com/en-us/library/windows/apps/hh465302.aspx before proceeding. What would you do if you had more folders than space for buttons on the AppBar? The FilePicker control was made for this purpose and may be a better option here. You could put one button in the AppBar which launches a FilePicker. – Jennifer Marsman - MSFT Feb 19 '13 at 15:17
  • thanks a lot Flyout data was static (image) now my question is any other way to show my folder images dynamic inside of Flyout Field something like this example : [link](http://stackoverflow.com/questions/4204728/how-to-display-folders-and-sub-folders-from-dir-in-php) – srini Feb 20 '13 at 12:00