locked
How can I have a list in localized storage. How can I resuse this windows phone code in windows 8

    Question

  • Hey ,

    I want to have a list in localized storage in Windows 8 app. I have already done that for windows phone how can I do the same thing for windows 8?

    Here is the code

    private void Button_Click(object sender, RoutedEventArgs e)
            {
    
                IsolatedStorageSettings.ApplicationSettings.TryGetValue("historyg", out fromStorage);
               
                if(fromStorage==null){
                    IsolatedStorageSettings.ApplicationSettings["historyg"] = new List<string>();
                }
               
    
                    fromStorage = IsolatedStorageSettings.ApplicationSettings["historyg"] as List<string>;
                    fromStorage.Add(textBox.Text);
    
                    IsolatedStorageSettings.ApplicationSettings["historyg"] = fromStorage;
     
    
            }
    
            private  void  Button_Click_1(object sender, RoutedEventArgs e)
            {
    
                 List<string> fromStorage2 =  IsolatedStorageSettings.ApplicationSettings["historyg"] as List<string>;
                 phoneList.ItemsSource = new List<string>();
                 phoneList.ItemsSource =  fromStorage2;     
            }


    pratik

    Friday, May 23, 2014 2:22 AM

Answers

  • You cannot reuse that code. IsolatedStorage is only on Windows Phone. You cannot use it on Windows Store.

    See Accessing app data with the Windows Runtime for how to access app data in a Windows Store app.

    If you want to save a list in App settings you will need to serialize it into a string or split it into elements of a composite data value.

    -Rob

    Friday, May 23, 2014 6:09 AM
    Owner
  • You need to convert your list of strings into a single string. How best to do that will depend on what is in the strings.

    Depending on the contents you may need to quote elements of the string. Otherwise you might be able to just stick them together in a comma separated list.

    If you want somebody to write sample code for you, you need to be clear about what you need. Otherwise you're asking people to waste their time and yours writing something that likely won't meet your needs.

    --Rob

    Friday, May 30, 2014 12:32 AM
    Owner

All replies

  • You cannot reuse that code. IsolatedStorage is only on Windows Phone. You cannot use it on Windows Store.

    See Accessing app data with the Windows Runtime for how to access app data in a Windows Store app.

    If you want to save a list in App settings you will need to serialize it into a string or split it into elements of a composite data value.

    -Rob

    Friday, May 23, 2014 6:09 AM
    Owner
  • Can I please have a demo or some useful links to some demos 

    Thanks! 


    pratik

    Friday, May 23, 2014 2:07 PM
  • See the links I provided for sample code snippets.

    If you need something more specific after looking at that please give details on what you need.

    Saturday, May 24, 2014 12:58 AM
    Owner
  • Yes,

    I want to know how we can create a list in Windows 8 app


    pratik

    Saturday, May 24, 2014 2:12 AM
  • You create a list the same way as in Windows Phone. The problem is that you cannot use a List, you need to use a string. How best to create that will depend on your data.

    --Rob

    Wednesday, May 28, 2014 1:36 AM
    Owner
  • On my data? my data is localized right and it is string type


    pratik

    Thursday, May 29, 2014 3:37 AM
  • You need to convert your list of strings into a single string. How best to do that will depend on what is in the strings.

    Depending on the contents you may need to quote elements of the string. Otherwise you might be able to just stick them together in a comma separated list.

    If you want somebody to write sample code for you, you need to be clear about what you need. Otherwise you're asking people to waste their time and yours writing something that likely won't meet your needs.

    --Rob

    Friday, May 30, 2014 12:32 AM
    Owner