private void InitializeLibrarySettings(LibrarySettings savedData) { this.Tags.SetSource(savedData.RegisteredTags); if (savedData.DefaultSort == null || savedData.DefaultSort.Count == 0) { var sort = new List <SortSetting>(); sort.Add(new SortSetting() { Property = FileProperty.DateTimeModified, IsDescending = true, }); savedData.DefaultSort = sort; } this.Searcher.DefaultSort = savedData.DefaultSort; if (savedData.DefaultGroupSort == null || savedData.DefaultGroupSort.Count == 0) { var sort = new List <SortSetting>(); sort.Add(new SortSetting() { Property = FileProperty.RelativePathSequenceNum, IsDescending = false, }); savedData.DefaultGroupSort = sort; } this.Searcher.DefaultGroupSort = savedData.DefaultGroupSort; if (savedData.GroupLeaderDictionary == null) { savedData.GroupLeaderDictionary = new Dictionary <string, GroupLeaderFile>(); } this.Searcher.GroupLeaderDictionary = savedData.GroupLeaderDictionary; if (savedData.SearchSettings == null || savedData.SearchSettings.Count == 0) { savedData.SearchSettings = new List <SearchInformation>(); //savedData.SearchSettings.Add(new SearchInformation(new ComplexSearchSetting(false))); } else { var search = savedData.SearchSettings.ToList(); savedData.SearchSettings = search; } savedData.SearchSettings.ForEach(x => this.Searcher.AddSearch(x)); if (savedData.FavoriteSearch != null) { this.Searcher.FavoriteSearchList = new ObservableCollection <SearchInformation> (savedData.FavoriteSearch.Select(x => x.Clone())); } if (savedData.Folders == null) { savedData.Folders = new Dictionary <string, FolderInformation>(); } foreach (var item in this.Searcher.GroupLeaderDictionary) { item.Value.UniqueKey = item.Key; } this.librarySettings = savedData; this.IsLibrarySettingsLoaded = true; }
private async Task <bool> LoadSettingsAsync() { using (await storageAccessLock.LockAsync()) { this.XmlLoadingMessages.Clear(); var loaded = await this.settingXml.LoadXmlAsync(XmlLoadingOptions.ReturnNull); if (loaded.Value != null) { this.coreSettings = loaded.Value; } else { return(false); //オプション初期値 //this.coreSettings = new ApplicationSettings(); } if (loaded.Message != null) { this.XmlLoadingMessages.Add(loaded.Message.Message); } //coreSettings.SearchSettings = coreSettings.SearchSettingsOld.Select(x => new SearchInformation(x)).ToList(); if (this.coreSettings.Version < 3) { //Ver.3以降 this.coreSettings.SlideshowAnimationTimeMillisec = 300; this.coreSettings.SlideshowFlipTimeMillisec = 5000; this.coreSettings.IsSlideshowResizingAlways = false; this.coreSettings.IsSlideshowResizeToFill = false; this.coreSettings.IsSlideshowRandom = false; } if (this.coreSettings.Version < 3) { //Ver.4以降 this.coreSettings.IsSlideshowFullScreen = true; } this.IsCoreSettingsLoaded = true; //LibrarySettings tmpLibSettings; if (this.coreSettings.Version < 4) { //Ver.4以降 var tmpLibSettings = new LibrarySettings(); tmpLibSettings.CopyFrom(this.coreSettings); this.InitializeLibrarySettings(tmpLibSettings); } this.coreSettings.ClearOldPoperties(); return(true); } }