WP7 – Simple Network Opt-in Implementation

I’m giving the users of my WP7 app the ability to save their data to a central server and per the developer guidelines I need to get permission from the user to do so.  Wasn’t sure how to do this at first but I remembered that MessageBox works with WP7. 

So here is my implementation:

XAML –

<CheckBox x:Name="SaveDataToServer" IsChecked="{Binding SaveDataToServerAutomatically, Mode=TwoWay}" />

ViewModel –

public bool SaveDataToServerAutomatically
{
    get
    {
        return _applicationSettings.SaveDataToServerAutomatically;
    }
    set
    {
        var autoSave = value;
        if (autoSave)
            autoSave = MessageBoxResult.OK == MessageBox.Show("Are you sure you want to send you data across the web and save it to a central server?",
                "Send Location Data Consent",
                MessageBoxButton.OKCancel);
        _applicationSettings.SaveDataToServerAutomatically = autoSave;
        RaisePropertyChanged("SaveDataToServerAutomatically");
    }
}

What do you think?  Any better ideas?  Please leave comments.

Leave a Reply