public static void SaveConfig(Config options) { try { Serializer.Serialize(SettingsFilePath, options); } catch { } }
public static Config Validate(Config config) { if (config.UpdateDelay == 0) config.UpdateDelay = 30; if (string.IsNullOrEmpty(config.LastVersion)) config.LastVersion = VersionInfo.Version.ToString(); if (string.IsNullOrEmpty(config.InstallPath)) config.InstallPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); return config; }
ObservableCollection<EditTrackRepository> CreateEditRepositories(Config config) { return config.Repositories.Return(x => new ObservableCollection<EditTrackRepository>(config.Repositories.Select(CreateEditRepository)), () => new ObservableCollection<EditTrackRepository>()); }
public EditConfigViewModel(Config config) { this.config = config; this.configsReader = new RepoConfigsReader(); KeyGesture = config.KeyGesture; SupportsTesting = config.SupportsTesting; DefaultTheme = config.DefaultTheme; Configs = this.configsReader.RegisteredConfigs; UpdateDelay = AtomFeed.FeedWorker.UpdateDelay; RefreshUpdateCommand = DelegateCommandFactory.Create(AtomFeed.FeedWorker.Update); CommonXaml = GetWpf2SlKey("Common"); DiagramXaml = GetWpf2SlKey("Diagram"); XPFGITXaml = GetWpf2SlKey("XPF"); Repositories = CreateEditRepositories(config); Repositories.CollectionChanged += RepositoriesOnCollectionChanged; AlwaysSure4 = AlwaysSure3 = AlwaysSure2 = AlwaysSure1 = config.AlwaysSure; TestByDefault = config.TestByDefault; UpdateWpf2SLProperties = new AsyncCommand(OnUpdateWpf2SLProperties); UpdateTokens(); }