public void UpdateIcon()
        {
            FavoriteFolder favorites = Settings.Default.FavoriteRepos;

            Color tabColor = favorites.BreadthFirstSearch((f) => f is FavoriteRepo r && this.RepoItem == r.Repo)?.Color
                             ?? favorites.BreadthFirstSearch((f) => f is FavoriteReposDirectory d && this.RepoItem.StartsWith(d.Directory))?.Color
                             ?? Color.Black;

            if (tabColor != this.Color ||
                this.Tab.Icon == null)
            {
                this.Color = tabColor;

                Bitmap icon;
                if (File.Exists(this.RepoItem))
                {
                    icon = Resources.File;
                }
                else
                {
                    icon = Resources.Folder;
                }

                if (tabColor == Color.Black)
                {
                    this.Tab.Icon = icon;
                }
                else
                {
                    this.Tab.Icon = Util.ColorBitmap(icon, tabColor);
                }
            }
        }
예제 #2
0
 public static FavoriteFolderCreatorDialog FromFavoriteFolder(FavoriteFolder favorite)
 {
     return(new FavoriteFolderCreatorDialog()
     {
         FavoriteName = favorite.Name,
         FavoriteColor = favorite.Color,
     });
 }
        private FavoritesManagerDialog(FavoriteFolder favorites)
        {
            InitializeComponent();

            this.Icon = Resources.TortoiseIcon;

            FavoritesTree.MouseUp += FavoritesTree_MouseUp;

            FavoritesContextMenu.Opening += FavoritesContextMenu_Opening;

            AddFavoritesFolderMenuItem.Click += AddFavoritesFolderMenuItem_Click;
            AddRepoMenuItem.Click            += AddRepoMenuItem_Click;
            AddReposDirectoryMenuItem.Click  += AddReposDirectoryMenuItem_Click;

            EditFavoriteMenuItem.Click   += EditFavoriteMenuItem_Click;
            RemoveFavoriteMenuItem.Click += RemoveFavoriteMenuItem_Click;

            _favoritesDragDropHelper = new FavoritesDragDropHelper(this);
            _favoritesDragDropHelper.AddControl(FavoritesTree);

            Favorites = favorites;
            UpdateFavoritesTree(Favorites);
        }
예제 #4
0
 public FavoriteCollection(FavoriteFolder owner)
 {
     _owner = owner;
 }