コード例 #1
0
 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());
 }
コード例 #2
0
        private IUserSettingsLoader <HostProperties> BuildLoader(FileInfo file)
        {
            var defaultValue = FillMissingProps(new HostProperties());
            var factory      = UserSettingsFactory
                               .Create <HostProperties>()
                               .SetDefaultValue(defaultValue)
                               .SetFile(file);

            return(factory.Build());
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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();
        }
コード例 #6
0
 public static IUserSettings GetDefaultUserSettings()
 {
     return(UserSettingsFactory.GetSettings(UserSettingsType));
 }
コード例 #7
0
 private ThumbnailCacheInFolder()
 {
     settings = UserSettingsFactory.GetSettings(UserSettingsFactory.SettingsType.RegularSettings);
 }