From bb409f76500651f32672ee775ff61e88c6d32fb9 Mon Sep 17 00:00:00 2001 From: MysticBoy Date: Fri, 15 Mar 2019 17:29:04 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E5=8F=B3=E9=94=AE?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E6=A0=87=E9=A2=98=E9=83=A8=E5=88=86=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Home/AttachmentsNavigationItem.cs | 10 ++---- .../Home/GiteeHomeSection.cs | 10 +++--- .../Home/GiteeNavigationItem.cs | 25 ++++++++++--- .../Home/IssuesNavigationItem.cs | 7 +--- .../Home/PullRequestsNavigationItem.cs | 7 +--- .../Home/StatisticsNavigationItem.cs | 7 +--- .../Home/WikiNavigationItem.cs | 8 +---- .../Strings.zh-Hans.resx | 2 +- .../Services/GitAnalysis.cs | 35 ++++++++++++------- 9 files changed, 56 insertions(+), 55 deletions(-) diff --git a/src/Gitee.TeamFoundation.14/Home/AttachmentsNavigationItem.cs b/src/Gitee.TeamFoundation.14/Home/AttachmentsNavigationItem.cs index 46dbd95..e7b4ada 100644 --- a/src/Gitee.TeamFoundation.14/Home/AttachmentsNavigationItem.cs +++ b/src/Gitee.TeamFoundation.14/Home/AttachmentsNavigationItem.cs @@ -10,7 +10,8 @@ namespace Gitee.TeamFoundation.Home [PartCreationPolicy(CreationPolicy.NonShared)] public class AttachmentsNavigationItem : GiteeNavigationItem { - private readonly ITeamExplorerServices _tes; + private readonly ITeamExplorerServices _tes; + [ImportingConstructor] public AttachmentsNavigationItem(IGitService git, IShellService shell, IStorage storage, ITeamExplorerServices tes, IWebService ws) : base(Octicon.attachment, git, shell, storage, tes, ws) @@ -18,14 +19,9 @@ namespace Gitee.TeamFoundation.Home Text = Strings.Items_Attachments; } - protected override void SetDefaultColors() - { - m_defaultArgbColorBrush = new SolidColorBrush(Colors.LightBlueNavigationItem); - } - public override void Execute() { OpenInBrowser(_tes.Project.ReleasesUrl); } } -} +} \ No newline at end of file diff --git a/src/Gitee.TeamFoundation.14/Home/GiteeHomeSection.cs b/src/Gitee.TeamFoundation.14/Home/GiteeHomeSection.cs index 44ad10b..f416e05 100644 --- a/src/Gitee.TeamFoundation.14/Home/GiteeHomeSection.cs +++ b/src/Gitee.TeamFoundation.14/Home/GiteeHomeSection.cs @@ -28,25 +28,25 @@ namespace Gitee.TeamFoundation.Home var gitExt = ServiceProvider.GetService(); gitExt.PropertyChanged += GitExt_PropertyChanged; } + private void GitExt_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (e.PropertyName == "ActiveRepositories") { this.Refresh(); } - } + } + public override void Refresh() { Task.Run(() => { - return _tes.IsGiteeRepoAsync(); - + return _tes.IsGiteeRepoAsync(); }).ContinueWith(async (Task r) => { await ThreadingHelper.SwitchToMainThreadAsync(); IsVisible = await r; - }); ; - + }); ; } protected override ITeamExplorerSection CreateViewModel(SectionInitializeEventArgs e) diff --git a/src/Gitee.TeamFoundation.14/Home/GiteeNavigationItem.cs b/src/Gitee.TeamFoundation.14/Home/GiteeNavigationItem.cs index 431d2f7..2ea4492 100644 --- a/src/Gitee.TeamFoundation.14/Home/GiteeNavigationItem.cs +++ b/src/Gitee.TeamFoundation.14/Home/GiteeNavigationItem.cs @@ -1,6 +1,7 @@ using Gitee.VisualStudio.Shared; using Gitee.VisualStudio.Shared.Controls; using Microsoft.TeamFoundation.Controls.WPF.TeamExplorer; +using Microsoft.VisualStudio.PlatformUI; using System; using System.Threading.Tasks; using System.Windows.Media; @@ -16,7 +17,8 @@ namespace Gitee.TeamFoundation.Home private readonly IWebService _web; private Project _project; - private string _branch; + private string _branch; + private Octicon octicon; public GiteeNavigationItem(Octicon icon, IGitService git, IShellService shell, IStorage storage, ITeamExplorerServices tes, IWebService web) { @@ -25,10 +27,23 @@ namespace Gitee.TeamFoundation.Home _storage = storage; _tes = tes; _web = web; - var brush = new SolidColorBrush(Color.FromRgb(66, 66, 66)); brush.Freeze(); - m_icon = SharedResources.GetDrawingForIcon(icon, brush); + octicon = icon; + OnThemeChanged(); + VSColorTheme.ThemeChanged += _ => + { + OnThemeChanged(); + Invalidate(); + }; + } + + private void OnThemeChanged() + { + var theme = Colors.DetectTheme(); + var dark = theme == "Dark"; + m_defaultArgbColorBrush = new SolidColorBrush(dark ? Colors.DarkThemeNavigationItem : Colors.LightBlueNavigationItem); + m_icon = SharedResources.GetDrawingForIcon(octicon, dark ? Colors.DarkThemeNavigationItem : Colors.LightThemeNavigationItem, theme); } public override void Invalidate() @@ -39,7 +54,7 @@ namespace Gitee.TeamFoundation.Home }).ContinueWith(async (Task b) => { IsVisible = await b; - }); ; + }); } protected void OpenInBrowser(string endpoint) @@ -47,4 +62,4 @@ namespace Gitee.TeamFoundation.Home _shell.OpenUrl(endpoint); } } -} +} \ No newline at end of file diff --git a/src/Gitee.TeamFoundation.14/Home/IssuesNavigationItem.cs b/src/Gitee.TeamFoundation.14/Home/IssuesNavigationItem.cs index 5911e7d..1e827a7 100644 --- a/src/Gitee.TeamFoundation.14/Home/IssuesNavigationItem.cs +++ b/src/Gitee.TeamFoundation.14/Home/IssuesNavigationItem.cs @@ -20,11 +20,6 @@ namespace Gitee.TeamFoundation.Home Text = Strings.Items_Issues; } - protected override void SetDefaultColors() - { - m_defaultArgbColorBrush = new SolidColorBrush(Colors.LightBlueNavigationItem); - } - public override void Invalidate() { base.Invalidate(); @@ -37,4 +32,4 @@ namespace Gitee.TeamFoundation.Home OpenInBrowser(_tes.Project.IssuesUrl); } } -} +} \ No newline at end of file diff --git a/src/Gitee.TeamFoundation.14/Home/PullRequestsNavigationItem.cs b/src/Gitee.TeamFoundation.14/Home/PullRequestsNavigationItem.cs index dfcbcb9..5a3aa8d 100644 --- a/src/Gitee.TeamFoundation.14/Home/PullRequestsNavigationItem.cs +++ b/src/Gitee.TeamFoundation.14/Home/PullRequestsNavigationItem.cs @@ -28,14 +28,9 @@ namespace Gitee.TeamFoundation.Home IsVisible = IsVisible && _tes.Project != null && _tes.Project.PullRequestsEnabled; } - protected override void SetDefaultColors() - { - m_defaultArgbColorBrush = new SolidColorBrush(Colors.RedNavigationItem); - } - public override void Execute() { OpenInBrowser(_tes.Project.PullsUrl); } } -} +} \ No newline at end of file diff --git a/src/Gitee.TeamFoundation.14/Home/StatisticsNavigationItem.cs b/src/Gitee.TeamFoundation.14/Home/StatisticsNavigationItem.cs index e2d4f00..dd0f763 100644 --- a/src/Gitee.TeamFoundation.14/Home/StatisticsNavigationItem.cs +++ b/src/Gitee.TeamFoundation.14/Home/StatisticsNavigationItem.cs @@ -21,15 +21,10 @@ namespace Gitee.TeamFoundation.Home Text = Strings.Items_Statistics; } - protected override void SetDefaultColors() - { - m_defaultArgbColorBrush = new SolidColorBrush(Colors.LightBlueNavigationItem); - } - public override void Execute() { var repo = _tes.GetActiveRepository(); OpenInBrowser(_tes.Project.StatisticsUrl); } } -} +} \ No newline at end of file diff --git a/src/Gitee.TeamFoundation.14/Home/WikiNavigationItem.cs b/src/Gitee.TeamFoundation.14/Home/WikiNavigationItem.cs index 9293401..7083912 100644 --- a/src/Gitee.TeamFoundation.14/Home/WikiNavigationItem.cs +++ b/src/Gitee.TeamFoundation.14/Home/WikiNavigationItem.cs @@ -28,15 +28,9 @@ namespace Gitee.TeamFoundation.Home IsVisible = IsVisible && _tes.Project != null && _tes.Project.HasWiki; } - protected override void SetDefaultColors() - { - m_defaultArgbColorBrush = new SolidColorBrush(Colors.BlueNavigationItem); - } - public override void Execute() { OpenInBrowser(_tes.Project.Url); } } -} - \ No newline at end of file +} \ No newline at end of file diff --git a/src/Gitee.VisualStudio.Shared/Strings.zh-Hans.resx b/src/Gitee.VisualStudio.Shared/Strings.zh-Hans.resx index e5b5964..5da57e9 100644 --- a/src/Gitee.VisualStudio.Shared/Strings.zh-Hans.resx +++ b/src/Gitee.VisualStudio.Shared/Strings.zh-Hans.resx @@ -230,7 +230,7 @@ 邮箱为必填 - 登陆失败 + 登录失败 忘记密码? diff --git a/src/Gitee.VisualStudio/Services/GitAnalysis.cs b/src/Gitee.VisualStudio/Services/GitAnalysis.cs index 5791f12..4265602 100644 --- a/src/Gitee.VisualStudio/Services/GitAnalysis.cs +++ b/src/Gitee.VisualStudio/Services/GitAnalysis.cs @@ -21,7 +21,7 @@ namespace Gitee.VisualStudio.Services public sealed class GitAnalysis : IDisposable { private readonly Repository repository; - readonly string targetFullPath; + private readonly string targetFullPath; public bool IsDiscoveredGitRepository => repository != null; @@ -34,10 +34,10 @@ namespace Gitee.VisualStudio.Services this.repository = new LibGit2Sharp.Repository(repositoryPath); RepositoryPath = repositoryPath; } - - } - static Dictionary dicgit = new Dictionary(); + + private static Dictionary dicgit = new Dictionary(); + public static GitAnalysis GetBy(string fullpath) { if (!dicgit.ContainsKey(fullpath)) @@ -46,6 +46,7 @@ namespace Gitee.VisualStudio.Services } return dicgit[fullpath]; } + public string RepositoryPath { get; private set; } public LibGit2Sharp.Repository Repository { get { return repository; } } @@ -55,10 +56,13 @@ namespace Gitee.VisualStudio.Services { case GiteeUrlType.CurrentBranch: return repository.Head.FriendlyName.Replace("origin/", ""); + case GiteeUrlType.CurrentRevision: return repository.Commits.First().Id.ToString(8); + case GiteeUrlType.CurrentRevisionFull: return repository.Commits.First().Id.Sha; + case GiteeUrlType.Master: default: return "master"; @@ -70,18 +74,23 @@ namespace Gitee.VisualStudio.Services switch (urlType) { case GiteeUrlType.CurrentBranch: - return "当前分支" + repository.Head.FriendlyName.Replace("origin/", ""); + return "浏览当前分支" + repository.Head.FriendlyName.Replace("origin/", ""); + case GiteeUrlType.CurrentRevision: - return $"修订{repository.Commits.First().Id.ToString(8)}"; + return $"浏览修订{repository.Commits.First().Id.ToString(8)}"; + case GiteeUrlType.CurrentRevisionFull: - return $"修订({repository.Commits.First().Id.ToString(8)})完整ID"; + return $"浏览修订({repository.Commits.First().Id.ToString(8)})完整ID"; + case GiteeUrlType.Blame: - return "追溯"; + return "按行查看"; + case GiteeUrlType.Commits: - return "提交"; + return "浏览提交历史"; + case GiteeUrlType.Master: default: - return "master"; + return "浏览主分支"; } } @@ -131,17 +140,19 @@ namespace Gitee.VisualStudio.Services } return urlRoot; } + public string GetRepoOriginRemoteUrl() { string urlRoot = string.Empty; var originUrl = repository.Config.Get("remote.origin.url"); if (originUrl != null) { - urlRoot = originUrl.Value ; + urlRoot = originUrl.Value; } return urlRoot; } - void Dispose(bool disposing) + + private void Dispose(bool disposing) { if (repository != null) { -- Gitee From e57d3cedfc45075c11356692b4a9900d5ea9caaa Mon Sep 17 00:00:00 2001 From: MysticBoy Date: Fri, 15 Mar 2019 18:53:32 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=85=8B=E9=9A=86?= =?UTF-8?q?=E7=AA=97=E4=BD=93=E7=9A=84=E5=A4=B4=E5=83=8F=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0=E6=9F=A5=E6=89=BE,=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=E5=85=8B=E9=9A=86=E5=91=BD=E4=BB=A4=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Gitee.VisualStudio.Shared/IWebService.cs | 18 +- .../ViewModels/CloneViewModel.cs | 386 ++++++------ .../ViewModels/ProjectViewModel.cs | 22 +- .../Views/CloneView.xaml | 569 +++++++++--------- 4 files changed, 531 insertions(+), 464 deletions(-) diff --git a/src/Gitee.VisualStudio.Shared/IWebService.cs b/src/Gitee.VisualStudio.Shared/IWebService.cs index 970be44..d56dbd1 100644 --- a/src/Gitee.VisualStudio.Shared/IWebService.cs +++ b/src/Gitee.VisualStudio.Shared/IWebService.cs @@ -43,18 +43,22 @@ namespace Gitee.VisualStudio.Shared } } - public bool HasIssues => Repo.has_issues; - public string IssuesUrl => $"{Repo.html_url}/issues"; + public bool HasIssues => Repo != null ? Repo.has_issues : false; + public string IssuesUrl => $"{Repo?.html_url}/issues"; - public Api.Dto.Owner Owner => Repo.Owner; + public Api.Dto.Owner Owner => Repo?.Owner; - public string PullsUrl => $"{Repo.html_url}/pulls"; + public string PullsUrl => $"{Repo?.html_url}/pulls"; - public bool PullRequestsEnabled => Repo.pull_requests_enabled; + public bool PullRequestsEnabled => Repo != null ? Repo.pull_requests_enabled : false; - public string ReleasesUrl => $"{Repo.html_url}/attach_files"; + public string ReleasesUrl => $"{Repo?.html_url}/attach_files"; - public string StatisticsUrl=> $"{Repo.html_url}/repository/stats/{Repo.default_branch}"; + public string StatisticsUrl => $"{Repo?.html_url}/repository/stats/{Repo?.default_branch}"; + + public string Description => Repo?.Description; + + public string DisplayName => Repo.human_name; } public class CreateResult diff --git a/src/Gitee.VisualStudio.UI/ViewModels/CloneViewModel.cs b/src/Gitee.VisualStudio.UI/ViewModels/CloneViewModel.cs index d44bc01..00c85ce 100644 --- a/src/Gitee.VisualStudio.UI/ViewModels/CloneViewModel.cs +++ b/src/Gitee.VisualStudio.UI/ViewModels/CloneViewModel.cs @@ -1,173 +1,213 @@ -using Gitee.VisualStudio.Shared; -using Gitee.VisualStudio.Shared.Helpers; -using Gitee.VisualStudio.Shared.Helpers.Commands; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.ComponentModel; -using System.Linq; -using System.Threading.Tasks; -using System.Windows.Data; -using System.Windows.Input; - -namespace Gitee.VisualStudio.UI.ViewModels -{ - public class CloneViewModel : Bindable - { - private ObservableCollection _repositories; - - private readonly IDialog _dialog; - private readonly IMessenger _messenger; - private readonly IShellService _shell; - private readonly IStorage _storage; - private readonly IWebService _web; - - public CloneViewModel(IDialog dialog, IMessenger messenger, IShellService shell, IStorage storage, IWebService web) - { - _dialog = dialog; - _messenger = messenger; - _shell = shell; - _storage = storage; - _web = web; - - _repositories = new ObservableCollection(); - - Repositories = CollectionViewSource.GetDefaultView(_repositories); - Repositories.GroupDescriptions.Add(new PropertyGroupDescription("Owner")); - - _baseRepositoryPath = _storage.GetBaseRepositoryDirectory(); - - LoadRepositoriesAsync(); - - _cloneCommand = new DelegateCommand(OnClone, CanClone); - _browseCommand = new DelegateCommand(OnBrowse); - } - - public ICollectionView Repositories { get; } - - private string _baseRepositoryPath; - public string BaseRepositoryPath - { - get { return _baseRepositoryPath; } - set { SetProperty(ref _baseRepositoryPath, value); } - } - - private DelegateCommand _browseCommand; - public ICommand BrowseCommand - { - get { return _browseCommand; } - } - - private DelegateCommand _cloneCommand; - public ICommand CloneCommand - { - get { return _cloneCommand; } - } - - private bool _isBusy; - public bool IsBusy - { - get { return _isBusy; } - set { SetProperty(ref _isBusy, value); } - } - - private string _message; - public string Message - { - get { return _message; } - set { SetProperty(ref _message, value); } - } - - private ProjectViewModel _selectedRepository; - public ProjectViewModel SelectedRepository - { - get { return _selectedRepository; } - set - { - SetProperty(ref _selectedRepository, value, () => _cloneCommand.InvalidateCanExecute()); - } - } - - private bool CanClone() - { - if (SelectedRepository == null) - { - return false; - } - - var potentialPath = System.IO.Path.Combine(BaseRepositoryPath, SelectedRepository.Name); - return !System.IO.Directory.Exists(potentialPath); - } - - private void OnBrowse() - { - var browsed = _shell.BrowseFolder(); - if (browsed != null) - { - BaseRepositoryPath = browsed; - } - } - - private void OnClone() - { - var path = System.IO.Path.Combine(BaseRepositoryPath, SelectedRepository.Name); - - var repository = new Repository - { - Name = SelectedRepository.Name, - Path = path, - Icon = SelectedRepository.Icon - }; - _messenger.Send("OnClone", SelectedRepository.Url, repository); - - _dialog.Close(); - } - - private void LoadRepositoriesAsync() - { - string error = null; - IEnumerable loaded = null; - - IsBusy = true; - Task.Run((Action)(async () => - { - try - { - loaded = await _web.GetProjectsAsync(); ; - } - catch (Exception) - { - error = Strings.CloneView_FailedToLoadProjects; - } - })).ContinueWith(task => - { - IsBusy = false; - _repositories.Clear(); - - if (error == null) - { - if (loaded == null) - { - Message = Strings.CloneView_NoProjects; - } - else - { - loaded.Each(o => _repositories.Add(new ProjectViewModel(o))); - - var first = _repositories.Select(o => o.Owner).FirstOrDefault(); - if (first != null) - { - first.IsExpanded = true; - } - } - } - else - { - Message = error; - } - }, TaskScheduler.FromCurrentSynchronizationContext()); - } - - - } -} +using Gitee.VisualStudio.Shared; +using Gitee.VisualStudio.Shared.Helpers; +using Gitee.VisualStudio.Shared.Helpers.Commands; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Globalization; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Data; +using System.Windows.Input; + +namespace Gitee.VisualStudio.UI.ViewModels +{ + public class CloneViewModel : Bindable + { + private ObservableCollection _repositories; + + private readonly IDialog _dialog; + private readonly IMessenger _messenger; + private readonly IShellService _shell; + private readonly IStorage _storage; + private readonly IWebService _web; + + public CloneViewModel(IDialog dialog, IMessenger messenger, IShellService shell, IStorage storage, IWebService web) + { + _dialog = dialog; + _messenger = messenger; + _shell = shell; + _storage = storage; + _web = web; + + _repositories = new ObservableCollection(); + + Repositories = CollectionViewSource.GetDefaultView(_repositories); + Repositories.GroupDescriptions.Add(new PropertyGroupDescription("Owner")); + Repositories.Filter = RepoFilter; + + _baseRepositoryPath = _storage.GetBaseRepositoryDirectory(); + + LoadRepositoriesAsync(); + + _cloneCommand = new DelegateCommand(OnClone, CanClone); + _browseCommand = new DelegateCommand(OnBrowse); + } + + public ICollectionView Repositories { get; } + + private string _baseRepositoryPath; + public string BaseRepositoryPath + { + get { return _baseRepositoryPath; } + set { SetProperty(ref _baseRepositoryPath, value); } + } + + private bool RepoFilter(object item) + { + var repo = item as ProjectViewModel; + + if (string.IsNullOrEmpty(FilterText)) + { + return true; + } + else + { + var compare = CultureInfo.CurrentCulture.CompareInfo; + return compare.IndexOf(repo.Name, FilterText, CompareOptions.IgnoreCase) != -1 + || compare.IndexOf(repo.Description, FilterText, CompareOptions.IgnoreCase) != -1; + } + + } + + private string _filterText; + + public string FilterText + { + get { return _filterText; } + set + { + _filterText = value; + Repositories.Refresh(); + } + } + + + private DelegateCommand _browseCommand; + public ICommand BrowseCommand + { + get { return _browseCommand; } + } + + private DelegateCommand _cloneCommand; + public ICommand CloneCommand + { + get { return _cloneCommand; } + } + + private bool _isBusy; + public bool IsBusy + { + get { return _isBusy; } + set { SetProperty(ref _isBusy, value); } + } + private bool _filterTextIsEnabled; + public bool FilterTextIsEnabled + { + get { return _filterTextIsEnabled; } + set { SetProperty(ref _filterTextIsEnabled, value); } + } + + + private string _message; + public string Message + { + get { return _message; } + set { SetProperty(ref _message, value); } + } + + private ProjectViewModel _selectedRepository; + public ProjectViewModel SelectedRepository + { + get { return _selectedRepository; } + set + { + SetProperty(ref _selectedRepository, value, () => _cloneCommand.InvalidateCanExecute()); + } + } + + private bool CanClone() + { + if (SelectedRepository == null) + { + return false; + } + + var potentialPath = System.IO.Path.Combine(BaseRepositoryPath, SelectedRepository.Name); + return !System.IO.Directory.Exists(potentialPath); + } + + private void OnBrowse() + { + var browsed = _shell.BrowseFolder(); + if (browsed != null) + { + BaseRepositoryPath = browsed; + } + } + + private void OnClone() + { + var path = System.IO.Path.Combine(BaseRepositoryPath, SelectedRepository.Name); + + var repository = new Repository + { + Name = SelectedRepository.Name, + Path = path, + Icon = SelectedRepository.Icon + }; + _messenger.Send("OnClone", SelectedRepository.Url, repository); + + _dialog.Close(); + } + + private void LoadRepositoriesAsync() + { + string error = null; + IEnumerable loaded = null; + + IsBusy = true; + Task.Run(async () => + { + try + { + loaded = await _web.GetProjectsAsync(); ; + } + catch (Exception) + { + error = Strings.CloneView_FailedToLoadProjects; + } + }).ContinueWith(task => + { + IsBusy = false; + _repositories.Clear(); + + if (error == null) + { + if (loaded == null) + { + Message = Strings.CloneView_NoProjects; + } + else + { + loaded.Each(o => _repositories.Add(new ProjectViewModel(o))); + + var first = _repositories.Select(o => o.Owner).FirstOrDefault(); + if (first != null) + { + first.IsExpanded = true; + } + FilterTextIsEnabled = true; + } + } + else + { + Message = error; + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + + } +} diff --git a/src/Gitee.VisualStudio.UI/ViewModels/ProjectViewModel.cs b/src/Gitee.VisualStudio.UI/ViewModels/ProjectViewModel.cs index 365999d..2ac9052 100644 --- a/src/Gitee.VisualStudio.UI/ViewModels/ProjectViewModel.cs +++ b/src/Gitee.VisualStudio.UI/ViewModels/ProjectViewModel.cs @@ -1,15 +1,17 @@ using Gitee.VisualStudio.Shared; using Gitee.VisualStudio.Shared.Controls; using System; - +using System.Windows; + namespace Gitee.VisualStudio.UI.ViewModels { public class Owner : IEquatable { public string Name { get; set; } - public string Avatar { get; set; } - public bool IsExpanded { get; set; } - + public string AvatarUrl { get; set; } + public bool IsExpanded { get; set; } + public string DisplayName => Name; + public override bool Equals(object obj) { if (obj == null || GetType() != obj.GetType()) @@ -37,20 +39,22 @@ namespace Gitee.VisualStudio.UI.ViewModels public string Url { get; set; } public Owner Owner { get; set; } public Octicon Icon { get; set; } - - public bool IsActive { get; set; } - + public string DisplayName { set; get; } + public bool IsActive { get; set; } + public string Description { get; set; } + public Visibility DescriptionVisibility => !string.IsNullOrEmpty(Description) ? (Description.Length > 10 ? Visibility.Visible : Visibility.Collapsed) : Visibility.Hidden; public ProjectViewModel(Project repository) { Name = repository.Name; Url = repository.Url; - + Description = repository.Description; + DisplayName = repository.DisplayName; if (repository.Owner != null) { Owner = new Owner { Name = repository.Owner.Name, - Avatar = repository.Owner.AvatarUrl + AvatarUrl = repository.Owner.AvatarUrl }; } diff --git a/src/Gitee.VisualStudio.UI/Views/CloneView.xaml b/src/Gitee.VisualStudio.UI/Views/CloneView.xaml index 442e87d..b3375d5 100644 --- a/src/Gitee.VisualStudio.UI/Views/CloneView.xaml +++ b/src/Gitee.VisualStudio.UI/Views/CloneView.xaml @@ -1,275 +1,294 @@ - - - - - - - - - - - - - - - - -