本文整理汇总了C#中ISettings.Load方法的典型用法代码示例。如果您正苦于以下问题:C# ISettings.Load方法的具体用法?C# ISettings.Load怎么用?C# ISettings.Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISettings
的用法示例。
在下文中一共展示了ISettings.Load方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SettingsViewModel
public SettingsViewModel(ISettings settings)
{
_settings = settings;
_settings.Load();
var availableDays = new List<int>();
for(int i = 0; i < 20; i++)
{
availableDays.Add((i + 1) * 5);
}
AvailableDays = availableDays;
SaveCommand = new RelayCommand<int>(days =>
{
_settings.ReputationHistory = days;
_settings.Save();
Messenger.Default.Send(new MoveToViewMessage(Page.MainPage));
});
}
示例2: HomeViewModel
public HomeViewModel(ILog log, IAccount account, ILocalize localize, IApplication application, IHistory history,
INavigationService navigationService, IUser user, IRepository repository,
IList<IExerciseType> exerciseTypes, ISettings settings)
{
_log = log;
_localize = localize;
_application = application;
Account = account;
_history = history;
_history.OnHistoryItemsChanged += _history_OnHistoryItemsChanged;
_NavigationService = navigationService;
User = user;
ExerciseTypes = exerciseTypes;
_repository = repository;
_settings = settings;
_settings.OnSettingsChanged += _settings_OnSettingsChanged;
_settings.Load();
_history.Load();
_repository.Single<User>(1).ContinueWith(t =>
{
var foundUser = t.Result;
if (foundUser == null)
{
//this is first load of the app, set it up
_repository.Insert<User>(this.User).ContinueWith(task =>
{
this.User = this.User;
Account.AccessToken = this.User.RunkeeperToken;
});
}
else
{
User = foundUser;
Account.AccessToken = foundUser.RunkeeperToken;
}
});
if (_exerciseTypes == null || _exerciseTypes.Count == 0 ||
(_exerciseTypes.Count == 1 && _exerciseTypes[0].Id == 0))
{
if (HomeViewModel.cachedTypes != null)
{
this.ExerciseTypes = HomeViewModel.cachedTypes;
_log.Info("cache hit");
}
else
{
_log.Info("cache miss");
this.ExerciseTypes = DefaultTypes;
_log.Info("default types set, querying");
_repository.Query<ExerciseType>("select * from ExerciseType").ContinueWith(t =>
{
_log.Info("query complete");
var types = t.Result;
if (types == null || types.Count == 0)
{
_log.Info("db does not have Exercise types, loading default items");
foreach (var e in from tt in this.ExerciseTypes orderby tt.Id select tt)
{
_repository.Insert<ExerciseType>(e);
}
}
else
{
_log.Info("all excecise types retreived from the db, update local data store");
this.ExerciseTypes = (from tt in types select tt).ToArray();
}
_log.Info("cache extypes to static var");
HomeViewModel.cachedTypes = ExerciseTypes;
});
}
}
}