/// <summary> /// Create and load the file list based on the settings /// </summary> public void UpdateFileList() { if (Settings.Instance.FileListIndex == 0) { // if none loaded or different from active one, reload if (this.activeList == null || this.activeList.Path != Settings.FileList_Online) { try { OnlineRepository online = new OnlineRepository(); if (online.SyncToLocal()) { if (File.Exists(Settings.FileList_Online)) { File.Delete(Settings.FileList_Online); } } this.BuildOnlineFile(); } catch (Exception ex) { ErrorLog.Log("Unable to sync with online repository, the cached list will be used.", ex); } WallpaperList list = null; try { list = new WallpaperList(Settings.FileList_Online, false); } catch (Exception e) { ErrorLog.Log("There was an error loading the online file list, loading an empty list.", e); if (File.Exists(Settings.FileList_Online)) { File.Delete(Settings.FileList_Online); } list = new WallpaperList(Settings.FileList_Online, false); } this.activeList = list; } c_copyPath.Visibility = Visibility.Collapsed; c_openFolder.Visibility = Visibility.Collapsed; c_deleteFile.Visibility = Visibility.Collapsed; } else { // if none loaded or different from active one, reload if (this.activeList == null || this.activeList.Path != Settings.FileList_Local) { WallpaperList list = null; try { list = new WallpaperList(Settings.FileList_Local, true); } catch (Exception e) { ErrorLog.Log("There was an error loading the local file list, loading an empty list.", e); if (File.Exists(Settings.FileList_Local)) { File.Delete(Settings.FileList_Local); } list = new WallpaperList(Settings.FileList_Local, true); } this.activeList = list; } c_copyPath.Visibility = Visibility.Visible; c_openFolder.Visibility = Visibility.Visible; c_deleteFile.Visibility = Visibility.Visible; } c_filelist.ItemsSource = this.activeList.List; if (this.activeList.Count > 0) { c_imagenext.IsEnabled = true; } else { c_imagenext.IsEnabled = false; } }