<commit_before>﻿using GitLab.VisualStudio.Shared;
using GitLab.VisualStudio.Shared.Controls;
using Microsoft.TeamFoundation.Controls.WPF.TeamExplorer;
using System;
using System.Windows.Media;

namespace GitLab.TeamFoundation.Home
{
    public abstract class GitLabNavigationItem : TeamExplorerNavigationItemBase
    {
        private readonly IGitService _git;
        private readonly IShellService _shell;
        private readonly IStorage _storage;
        private readonly ITeamExplorerServices _tes;
        private readonly IWebService _web;

        private Project _project;
        private string _branch;

        public GitLabNavigationItem(Octicon icon, IGitService git, IShellService shell, IStorage storage, ITeamExplorerServices tes, IWebService web)
        {
            _git = git;
            _shell = shell;
            _storage = storage;
            _tes = tes;
            _web = web;

            var brush = new SolidColorBrush(Color.FromRgb(66, 66, 66));
            brush.Freeze();
            m_icon = SharedResources.GetDrawingForIcon(icon, brush);
        }

        public override async void Invalidate()
        {
            IsVisible = await System.Threading.Tasks.Task.Factory.StartNew(() => _tes.IsGitLabRepo()) && _tes.Project != null;
        }

        protected void OpenInBrowser(string endpoint)
        {
            var user = _storage.GetUser();

            var url = $"{_storage.Host}/{user.Username}/{_tes.Project.Name}/{endpoint}";

            _shell.OpenUrl(url);
        }
        protected void OpenHostUrlInBrowser(string endpoint)
        {
            var user = _storage.GetUser();

            var url = $"{_storage.Host}/{endpoint}";

            _shell.OpenUrl(url);<commit_msg>修正了 参与其他人项目 和群的时候  无法正确打开 链接的问题。<commit_after>﻿using GitLab.VisualStudio.Shared;
using GitLab.VisualStudio.Shared.Controls;
using Microsoft.TeamFoundation.Controls.WPF.TeamExplorer;
using System;
using System.Windows.Media;

namespace GitLab.TeamFoundation.Home
{
    public abstract class GitLabNavigationItem : TeamExplorerNavigationItemBase
    {
        private readonly IGitService _git;
        private readonly IShellService _shell;
        private readonly IStorage _storage;
        private readonly ITeamExplorerServices _tes;
        private readonly IWebService _web;

        private Project _project;
        private string _branch;

        public GitLabNavigationItem(Octicon icon, IGitService git, IShellService shell, IStorage storage, ITeamExplorerServices tes, IWebService web)
        {
            _git = git;
            _shell = shell;
            _storage = storage;
            _tes = tes;
            _web = web;
        
            var brush = new SolidColorBrush(Color.FromRgb(66, 66, 66));
            brush.Freeze();
            m_icon = SharedResources.GetDrawingForIcon(icon, brush);
        }

        public override async void Invalidate()
        {
            IsVisible = await System.Threading.Tasks.Task.Factory.StartNew(() => _tes.IsGitLabRepo()) && _tes.Project != null;
        }

        protected void OpenInBrowser(string endpoint)
        {
            var url = $"{_tes.Project.web_url}/{endpoint}";
            _shell.OpenUrl(url);
        }
        protected void OpenHostUrlInBrowser(string endpoint)
        {
            var url = $"{_storage.Host}/{endpoint}";
            _shell.OpenUrl(url);
{'fraction_non_alphanumeric': 0.08412042502951594, 'fraction_numerical': 0.0035419126328217238, 'mean_word_length': 2.409456740442656, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6023751', 'n_tokens_mistral': 975, 'n_tokens_neox': 924, 'n_words': 215}