locked
starting metro app c# RRS feed

  • Question

  • Hello,

    sir iam using vs 2011 for metro style app development (c#)

    i selected a folder using folder picker an retrive all tumbnails of images in that folder(tumbnail) and  showed in mainpage.xaml when my app starts it always ask to pick folder ,but i need to start app first time for selection of folder. after selecting folder my app need to start images in mainpage.xaml

    what i need to do?


    please

    Monday, February 20, 2012 1:16 PM

Answers

All replies

  • Hello,

    iam using vs 2011 express with c# for metro style app 

    my app selcted some image files and retrive all images as tumbnail, but each time user starts app asks for pick file again, but  i need to show file picking button only one time. after successful selecion of image my app need to start directly to image without showing select button, i know that ineed to save image tumbnail, but i don,t know how?, how i can achieve this?

    please help me


    please

    Saturday, February 18, 2012 10:35 AM
  • Hi Santana,

    Your app should store the user's settings in its settings data so they can be persisted between sessions. Please see the Application Data topic for an overview of the different types of data stores available to your app.

    The application can use the AccessCache functions to remember and maintain access to the image files that were previously selected. The File access sample demonstrates how to use these functions to implement a most recently used list.

    --Rob

    Monday, February 20, 2012 9:15 PM
    Moderator
  • thank you sir but...

    iam already using application data for user settings (whether user selection finished or not)

    samples describes access one file at a time to access cache

    my app need to remember folder instead of files please help me...


    please

    Tuesday, February 21, 2012 3:34 AM
    • Marked as answer by Santana George Tuesday, February 21, 2012 6:28 AM
    Tuesday, February 21, 2012 5:53 AM
  • thank you sir 

    could you show how to use this class?


    please

    Tuesday, February 21, 2012 6:27 AM
  • The use pattern is nearly identical. Review the File picker sample. MainPage.xaml.cs line 162

    To expand on a section of the File Access Sample scenario5code it would look something like this

            #region scenario5code
    
            /// <summary>
            /// Adds sample.txt to the MRU list
            /// </summary>
            /// <param name="sender" /> this is the sender object
            /// <param name="e" /> this is the sender object
            async void AddToMruButton_Click(object sender, RoutedEventArgs e)
            {
                StorageFolder storageFolder = KnownFolders.DocumentsLibrary;
                
                try
                {
                    StorageFile sampleFile = await storageFolder.GetFileAsync("sample.txt");
                    token = StorageApplicationPermissions.MostRecentlyUsedList.Add(sampleFile);
                    token2 = StorageApplicationPermissions.FutureAccessList.Add(storageFolder);
                    this.Scenario5Output_textblock.Text = "The file sample.txt was added to the MRU and a token was stored.";
                }
                catch (FileNotFoundException)
                {
                    this.Scenario5Output_textblock.Text = "The file sample.txt does not exist. Use scenario one to create this file.";
                }
            }
    
            /// <summary>
            /// Shows the contents of the MRU list
            /// </summary>
            /// <param name="sender" /> this is the sender object
            /// <param name="e" /> this is the sender object
            async void ShowMRUListButton_Click(object sender, RoutedEventArgs e)
            {
                
                AccessListEntryView entries = StorageApplicationPermissions.MostRecentlyUsedList.Entries;
                AccessListEntryView entries2 = StorageApplicationPermissions.FutureAccessList.Entries;
                StringBuilder outputText = new StringBuilder("The MRU list contains the following items:\n\n");
                
                foreach (AccessListEntry entry in entries)
                {
                    StorageFile storageFile = await StorageApplicationPermissions.MostRecentlyUsedList.GetFileAsync(entry.Token);
                    outputText.Append(storageFile.FileName + "\n");
                }
                foreach (AccessListEntry entry in entries2)
                {
                    StorageFolder storageFldr = await StorageApplicationPermissions.FutureAccessList.GetFolderAsync(entry.Token);
                    outputText.Append(storageFldr.Name + "\n");
                }
    
                this.Scenario5Output_textblock.Text = outputText.ToString();
            }
    Thanks,

    -David
    Wednesday, February 22, 2012 2:33 AM
    Moderator
  • Thankyou for your response i know you have no time to spend with my cheap questions and i also know that this is very simple to code, but  c# is my first programming language which i want to study! please could you show how to save a folder to access cache ande retrive it for further use?

    please

    Wednesday, February 22, 2012 3:57 AM