protected override void InitializeEmptyValues(SettingsInitializationTrigger trigger) { if (Roots == null) { Roots = new IconRootFolders(); } if (FavoriteFolders == null) { FavoriteFolders = new FavoritePaths(); } if (FavoriteIcons == null) { FavoriteIcons = new FavoritePaths(); } }
/// <summary> /// Adds a new CheckBox with the given <paramref name="folder"/> to the list. /// </summary> /// <param name="folder">Folder to add.</param> private void AddCheckBox(string folder) { SenpaiDirectory dir = new SenpaiDirectory(folder, this); if (IgnoredPaths.Contains(folder)) { dir.Opacity = 0.5; dir.Visibility = Visibility.Collapsed; } if (FavoritePaths.Contains(folder)) { dir.BackgroundColor = new SolidColorBrush(Colors.Yellow); } _directoryList.Add(dir); NotifyOfPropertyChange(() => CanInvertCheckBoxes); }
/// <summary> /// Adds/removes the right clicked CheckBox to/from the <see cref="FavoritePaths"/>. /// </summary> public void AddPathToFavorites() { if (_currentRightClickedDirectory.BackgroundColor == null) { File.AppendAllText("FavoritePaths.txt", _currentRightClickedDirectory.FullPath + "\r\n"); FavoritePaths.Add(_currentRightClickedDirectory.FullPath); _currentRightClickedDirectory.BackgroundColor = new SolidColorBrush(Colors.Yellow); Logging.LogInfo("Manually added " + _currentRightClickedDirectory.FullPath + " to FavoritePaths.txt"); } else { List <string> paths = File.ReadAllLines("FavoritePaths.txt").ToList(); paths.Remove(_currentRightClickedDirectory.FullPath); File.WriteAllLines("FavoritePaths.txt", paths.ToArray()); _currentRightClickedDirectory.BackgroundColor = null; Logging.LogInfo("Manually removed " + _currentRightClickedDirectory.FullPath + " from FavoritePaths.txt"); } }