public WorkspacesViewModel(User user) { User = user.Name; ApiInitialized = false; Factory = new UserSettingsFactory(user); Workspaces = CreateObservableCollection(user.Workspaces); DownloadSettingsCommand = new RelayCommand(param => Factory.DownloadSetting()); UploadSettingsCommand = new RelayCommand(param => Factory.UploadSetting()); }
private IUserSettingsLoader <HostProperties> BuildLoader(FileInfo file) { var defaultValue = FillMissingProps(new HostProperties()); var factory = UserSettingsFactory .Create <HostProperties>() .SetDefaultValue(defaultValue) .SetFile(file); return(factory.Build()); }
public void TestSetDefaultValue() { var targetValue = new TestClass { Name = "batatas", Age = 30 }; var target = UserSettingsFactory .Create <TestClass>() .SetDefaultValue(targetValue); Assert.NotNull(target); Assert.Equal(targetValue, target.DefaultValue); }
public void TestUseDefaultValue() { var target = UserSettingsFactory .Create <TestClass>(); Assert.NotNull(target); var def = target.DefaultValue; Assert.NotNull(def); Assert.Equal("Unknown", def.Name); Assert.Equal(10, def.Age); }
public SettingsLoaderService(StartupArgs args) { // Select the file to use _file = string.IsNullOrEmpty(args.SettingsFile) ? GetDefaultFile() : new FileInfo(args.SettingsFile); // Init loader _settingsLoader = UserSettingsFactory .Create <T>() .SetDefaultValue(new T()) .SetFile(_file) .Build(); }
public static IUserSettings GetDefaultUserSettings() { return(UserSettingsFactory.GetSettings(UserSettingsType)); }
private ThumbnailCacheInFolder() { settings = UserSettingsFactory.GetSettings(UserSettingsFactory.SettingsType.RegularSettings); }