Note that there are some explanatory texts on larger screens.

plurals
  1. POIsolatedStorageSettings WP8
    primarykey
    data
    text
    <p>I have one problem which I cannot resolve (at least I didn't found solution yet...) I wanted to add data into IsolatedStorageSettings in WP8. My goal is to check if there are settings already in there, but when I want to check I get an exception which I cannot resolve. </p> <pre><code> private IsolatedStorageSettings appSettings = new IsolatedStorageSettings(); private void Button_Click(object sender, RoutedEventArgs e) { //correct this part if (String.IsNullOrEmpty((string)appSettings["ICE1"])|| String.IsNullOrEmpty((string)appSettings["ICE2"]) || String.IsNullOrEmpty((string)appSettings["ICE3"]) || String.IsNullOrEmpty((string)appSettings["address"]) || String.IsNullOrEmpty((string)appSettings["fullName"])) { appSettings.Add("fullName", fullName.Text); appSettings.Save(); appSettings.Add("address", address.Text); appSettings.Save(); if (Regex.IsMatch(prefix1.Text, "^+\\d{2,3}") &amp;&amp; Regex.IsMatch(number1.Text, "d{6,10}")) { appSettings.Add("ICE1", prefix1.Text + number1.Text); appSettings.Save(); } else { MessageBox.Show("Invalid prefix number, please use +01 and for numbers only 0-9..."); } if (Regex.IsMatch(prefix2.Text, "^+\\d{2,3}") &amp;&amp; Regex.IsMatch(number2.Text, "d{6,10}")) { appSettings.Add("ICE2", prefix2.Text + number2.Text); appSettings.Save(); } else { MessageBox.Show("Invalid prefix number, please use +01 and for numbers only 0-9..."); } if (Regex.IsMatch(prefix2.Text, "^+\\d{2,3}") &amp;&amp; Regex.IsMatch(number2.Text, "d{6,10}")) { appSettings.Add("ICE3", prefix2.Text + number2.Text); appSettings.Save(); } else { MessageBox.Show("Invalid prefix number, please use +01 and for numbers only 0-9..."); } MessageBox.Show("Your information is saved...!"); } else { // appSettings["fullName"] = fullName.Text; appSettings.Save(); appSettings["address"] = address.Text; appSettings.Save(); if (Regex.IsMatch(prefix1.Text, "^+\\d{2,3}") &amp;&amp; Regex.IsMatch(number1.Text, "d{6,10}")) { appSettings["ICE1"]= prefix1.Text + number1.Text; appSettings.Save(); } else { MessageBox.Show("Invalid prefix number, please use +01 and for numbers only 0-9..."); } if (Regex.IsMatch(prefix2.Text, "^+\\d{2,3}") &amp;&amp; Regex.IsMatch(number2.Text, "d{6,10}")) { appSettings["ICE2"] = prefix2.Text + number2.Text; appSettings.Save(); } else { MessageBox.Show("Invalid prefix number, please use +01 and for numbers only 0-9..."); } if (Regex.IsMatch(prefix2.Text, "^+\\d{2,3}") &amp;&amp; Regex.IsMatch(number2.Text, "d{6,10}")) { appSettings["ICE3"] = prefix3.Text + number3.Text; appSettings.Save(); } else { MessageBox.Show("Invalid prefix number, please use +01 and for numbers only 0-9..."); } MessageBox.Show("Your information is saved...!"); } </code></pre> <p>Can someone explain how IsolatedStorageWorks? How can I correct this part because this is causing the problem:</p> <pre><code>if (String.IsNullOrEmpty((string)appSettings["ICE1"])|| String.IsNullOrEmpty((string)appSettings["ICE2"]) || String.IsNullOrEmpty((string)appSettings["ICE3"]) || String.IsNullOrEmpty((string)appSettings["address"]) || String.IsNullOrEmpty((string)appSettings["fullName"])) </code></pre> <p>Do I need to do appSettings.Save() every each time when I wish to add the data or update-it...?</p> <p>I also have another problem of getting data from IsolatedStorageSettings:</p> <pre><code> public WindowsPhoneControl2() { InitializeComponent(); } string ice1; string ice2; string ice3; PhoneCallTask ptask = new PhoneCallTask(); private void Image_Tap(object sender, System.Windows.Input.GestureEventArgs e) { ptask.PhoneNumber = ice1; ptask.DisplayName = "Contact person 1"; ptask.Show(); } private void Image_Tap_1(object sender, System.Windows.Input.GestureEventArgs e) { ptask.PhoneNumber = ice2; ptask.DisplayName = "Contact person 2"; ptask.Show(); } private void Image_Tap_2(object sender, System.Windows.Input.GestureEventArgs e) { ptask.PhoneNumber = ice3; ptask.DisplayName = "Contact person 3"; ptask.Show(); } private void UserControl_Loaded(object sender, RoutedEventArgs e) { IsolatedStorageSettings appSettings = IsolatedStorageSettings.ApplicationSettings; appSettings.Contains("fullName"); fullName.Text = (string)appSettings["fullName"]; address.Text = (string)appSettings["address"]; phone1.Text = (string)appSettings["ICE1"]; phone2.Text = (string)appSettings["ICE1"]; phone3.Text = (string)appSettings["ICE1"]; ice1 = phone1.Text; ice2 = phone2.Text; ice3 = phone3.Text; } </code></pre> <p>especially this part which is supposed to get data from dictionary:</p> <pre><code> fullName.Text = (string)appSettings["fullName"]; address.Text = (string)appSettings["address"]; phone1.Text = (string)appSettings["ICE1"]; phone2.Text = (string)appSettings["ICE1"]; phone3.Text = (string)appSettings["ICE1"]; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload