none
Settings Implementation Issue - Unable to turn off Setting

Answers

  • That is, because you are checking whether an entry MobileSite exists. Once it has been initialized the check always returns true regardless of the value of MobileSite. Try something similar to

    if (ApplicationData.Current.RoamingSettings.Values.ContainsKey("MobileSite") &&
    (bool)ApplicationData.Current.RoamingSettings.Values["MobileSite"]) { dothis(); } else { dothis2(); }

    Edit: corrected retrieval of "MobileSite"'s Value

    • Edited by ARadsziwill Friday, August 03, 2012 10:24 AM
    • Proposed as answer by ARadsziwill Friday, August 03, 2012 10:25 AM
    • Marked as answer by ReignOfComputer Wednesday, August 08, 2012 5:46 AM
    Friday, August 03, 2012 10:19 AM

All replies

  • Are you using Callisto for Settings? then check my implementation http://metrorssreader.codeplex.com/SourceControl/changeset/view/18233#283273

    Zubair Ahmed | @zubairdotnet | zubairahmed.net | MetroRssReader.codeplex.com | facebook.com/zubair.ahmed.public

    • Proposed as answer by Zubair Sunday, July 29, 2012 2:11 PM
    Sunday, July 29, 2012 2:11 PM
  • I dont see where you are setting the MobileSite ToggleSwitch to be off? Do you mean it doesn't turn off even if you try to do it?

    Zubair Ahmed | @zubairdotnet | zubairahmed.net | MetroRssReader.codeplex.com | facebook.com/zubair.ahmed.public

    Sunday, July 29, 2012 2:15 PM
  • Hi, thanks for the reply. I can turn the switch on and off and it will show up as Toggled and not respectively, but once it has been turned on once the effects are permanent.

    Meaning, the first time I start the app and click the button, it is going to "dothis();". When I Toggle the switch, it will "dothis2();". When I deactivate the switch, it will STILL "dothis2();" instead of reverting to "dothis();".

    Yep, I'm using Callisto for Settings. I'll take a look at your code when I get back. Thanks.

    Sunday, July 29, 2012 2:30 PM
  • That is, because you are checking whether an entry MobileSite exists. Once it has been initialized the check always returns true regardless of the value of MobileSite. Try something similar to

    if (ApplicationData.Current.RoamingSettings.Values.ContainsKey("MobileSite") &&
    (bool)ApplicationData.Current.RoamingSettings.Values["MobileSite"]) { dothis(); } else { dothis2(); }

    Edit: corrected retrieval of "MobileSite"'s Value

    • Edited by ARadsziwill Friday, August 03, 2012 10:24 AM
    • Proposed as answer by ARadsziwill Friday, August 03, 2012 10:25 AM
    • Marked as answer by ReignOfComputer Wednesday, August 08, 2012 5:46 AM
    Friday, August 03, 2012 10:19 AM
  • Nice catch @ARadsziwill

    Zubair Ahmed | @zubairdotnet | zubairahmed.net | MetroRssReader.codeplex.com | facebook.com/zubair.ahmed.public

    Friday, August 03, 2012 10:22 AM
  • That worked, thanks so much, both of you :P
    Wednesday, August 08, 2012 5:47 AM