Windows Phone 7
[wp7] 효율적인 isolatedStorageSetting 사용법
동동(이재동)
2011. 1. 7. 12:53
그냥 무턱 대고 쓰기 보다는 이렇게 class로 정의 하는것이 효율적이다.
name도 const로 깔끔하게 정의 하고
역시 팀장님은 다른거 같다 ㅋㅋ
public class SettingsService
{
const string NormalCoinStyleKey = "NormalCoinStyle";
const string DefaultNormalCoinType = "Basic";
public SettingsService()
{
if (IsolatedStorageSettings.ApplicationSettings.Contains(NormalCoinStyleKey) == false)
{
IsolatedStorageSettings.ApplicationSettings.Add(NormalCoinStyleKey, DefaultNormalCoinType);
}
}
public string NormalCoinStyle
{
get
{
return IsolatedStorageSettings.ApplicationSettings[NormalCoinStyleKey] as string;
}
set
{
IsolatedStorageSettings.ApplicationSettings[NormalCoinStyleKey] = value;
IsolatedStorageSettings.ApplicationSettings.Save();
}
}
}