public ConfigurationViewModel() { // ComboBoxの初期値を設定するにはItemsSourceで利用しているインスタンスの中から指定する必要がある SelectedSwatch = new ReactivePropertySlim <Swatch>(Swatches.FirstOrDefault(s => s.Name == ThemeService.CurrentTheme.Name)); SelectedSwatch.Subscribe(s => ChangeTheme(s)).AddTo(CompositeDisposable); var backupPath = UserConfigurationManager.Instance.GetConfiguration <BackupPathConfig>(ConfigKey.BackupPath); BackupPath = new ReactivePropertySlim <string>(backupPath?.DirectoryPath); var favorites = UserConfigurationManager.Instance.GetConfiguration <FavoriteWorkTasksConfig>(ConfigKey.FavoriteWorkTask); FavoriteWorkTasks = new ObservableCollection <FavoriteWorkTask>(favorites?.FavoriteWorkTasks ?? new FavoriteWorkTask[0]); var maps = UserConfigurationManager.Instance.GetConfiguration <ScheduleTitleMapConfig>(ConfigKey.ScheduleTitleMap)?.ScheduleTitleMaps; if (maps == null || maps.Count() == 0) { // 新設定が未登録なら旧設定をとる var config = JsonFileIO.Deserialize <TimeRecorderConfiguration>("TimeRecorderConfiguration.json") ?? new TimeRecorderConfiguration(); maps = config.WorkTaskBuilderConfig.TitleMappers?.Select(t => t.ConvertToScheduleTitleMap()).ToArray(); } ScheduleTitleMaps = new ObservableCollection <ScheduleTitleMap>(maps ?? new ScheduleTitleMap[0]); ShowFavoriteDescription = new ReactivePropertySlim <bool>(FavoriteWorkTasks.Count == 0); ShowScheduleDescription = new ReactivePropertySlim <bool>(ScheduleTitleMaps.Count == 0); var url = UserConfigurationManager.Instance.GetConfiguration <WorkingHourImportApiUrlConfig>(ConfigKey.WorkingHourImportApiUrl); WorkingHourImportUrl = new ReactivePropertySlim <string>(url?.URL); }
public void Reload() { if (File.Exists(_FileName) == false) { return; } var config = JsonFileIO.Deserialize <WindowPlacementJSON>(_FileName); Placement = config?.ConvertToInteropStruct(); }
public ImportTaskFromCalendarUseCase BuildImportTaskFromCalendarUseCase() { // 設定を再起動なしで反映させるために都度生成する var config = JsonFileIO.Deserialize <TimeRecorderConfiguration>("TimeRecorderConfiguration.json") ?? new TimeRecorderConfiguration(); var maps = UserConfigurationManager.Instance.GetConfiguration <ScheduleTitleMapConfig>(ConfigKey.ScheduleTitleMap); return(new ImportTaskFromCalendarUseCase( ContainerHelper.Resolver.Resolve <IWorkTaskRepository>(), ContainerHelper.Resolver.Resolve <IScheduledEventRepository>(), ContainerHelper.Resolver.Resolve <IWorkingTimeRangeRepository>(), config.WorkTaskBuilderConfig, maps?.ScheduleTitleMaps)); }