Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 144359f

Browse files
committed
Merge master into feature/pr/views
2 parents fc7d281 + a10a83c commit 144359f

File tree

18 files changed

+407
-223
lines changed

18 files changed

+407
-223
lines changed

documentation/manifest.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@
9393
- [ ] Verify Issues button navigates to Issues page on GitHub.com (when logged in and the repository is enabled)
9494
- [ ] **Creating Multiple Repositories**
9595
- [ ] Go to Team Explorer Connect page (logged in)
96-
- [ ] Create additional repository
97-
- [ ] Publish new repository
98-
- [ ] Verify remote information present in repository settings
96+
- [ ] Create additional repository
97+
- [ ] Publish new repository
98+
- [ ] Verify remote information present in repository settings
9999
- [ ] **Validate Publish Repository Error**
100100
- [ ] Remove remote settings from repository
101101
- [ ] Go to Sync page and publish repository
@@ -121,3 +121,10 @@
121121
- [ ] **Login with 2FA on**
122122
- [ ] Login GitHub with 2FA turned on
123123
- [ ] Resend works
124+
125+
# Settings
126+
- [ ] **Property page loads outside of team explorer view**
127+
- [ ] Select solution explorer as focused pane
128+
- [ ] Restart Visual Studio
129+
- [ ] Go to GitHub for VS property pane in Options
130+
- [ ] Property page loads without errors

src/GitHub.Exports/GitHub.Exports.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@
133133
<DesignTime>True</DesignTime>
134134
<DependentUpon>IPackageSettings.tt</DependentUpon>
135135
</Compile>
136+
<Compile Include="Settings\GitHubConnectSectionState.cs" />
137+
<Compile Include="Settings\UIState.cs" />
136138
<Compile Include="ViewModels\IServiceProviderAware.cs" />
137139
<Compile Include="UI\IView.cs" />
138140
<Compile Include="UI\Octicon.cs" />
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using System;
2+
using GitHub.Settings;
3+
4+
namespace GitHub.Settings
5+
{
6+
/// <summary>
7+
/// Stores persistent UI state for a <see cref="GitHubConnectSection"/> in
8+
/// <see cref="IPackageSettings"/>.
9+
/// </summary>
10+
public class GitHubConnectSectionState
11+
{
12+
/// <summary>
13+
/// Gets or sets the name of the connection section.
14+
/// </summary>
15+
public string SectionName { get; set; }
16+
17+
/// <summary>
18+
/// Gets or sets a value indicating whether the section should be expanded.
19+
/// </summary>
20+
public bool IsExpanded { get; set; } = true;
21+
}
22+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using GitHub.Settings;
4+
using System.Linq;
5+
using GitHub.VisualStudio.TeamExplorer.Connect;
6+
7+
namespace GitHub.Settings
8+
{
9+
/// <summary>
10+
/// Stores persistent UI state in <see cref="IPackageSettings"/>.
11+
/// </summary>
12+
public class UIState
13+
{
14+
/// <summary>
15+
/// Gets or sets the UI state for the <see cref="IGitHubConnectSection"/>s in Team Explorer.
16+
/// </summary>
17+
public List<GitHubConnectSectionState> GitHubConnectSections { get; set; }
18+
= new List<GitHubConnectSectionState>();
19+
20+
/// <summary>
21+
/// Gets or creates the UI state for a named <see cref="IGitHubConnectSection"/>.
22+
/// </summary>
23+
/// <param name="sectionName">The name of the section.</param>
24+
/// <returns>A <see cref="GitHubConnectSectionState"/> object.</returns>
25+
public GitHubConnectSectionState GetOrCreateConnectSection(string sectionName)
26+
{
27+
var result = GitHubConnectSections.FirstOrDefault(x => x.SectionName == sectionName);
28+
29+
if (result == null)
30+
{
31+
result = new GitHubConnectSectionState { SectionName = sectionName };
32+
GitHubConnectSections.Add(result);
33+
}
34+
35+
return result;
36+
}
37+
}
38+
}

src/GitHub.Exports/Settings/generated/IPackageSettings.tt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,6 @@ foreach (var j in json["settings"].Children()) {
2727
<#
2828
}
2929
#>
30+
UIState UIState { get; }
3031
}
3132
}

src/GitHub.TeamFoundation.14/Connect/GitHubConnectSection.cs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
using System.Threading.Tasks;
2020
using GitHub.VisualStudio.UI;
2121
using GitHub.Primitives;
22+
using GitHub.Settings;
2223

2324
namespace GitHub.VisualStudio.TeamExplorer.Connect
2425
{
@@ -27,6 +28,9 @@ public class GitHubConnectSection : TeamExplorerSectionBase, IGitHubConnectSecti
2728
readonly int sectionIndex;
2829
bool isCloning;
2930
bool isCreating;
31+
IPackageSettings packageSettings;
32+
GitHubConnectSectionState settings;
33+
3034
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
3135
SectionStateTracker sectionTracker;
3236

@@ -83,17 +87,21 @@ public ISimpleRepositoryModel SelectedRepository
8387

8488
internal ITeamExplorerServiceHolder Holder => holder;
8589

86-
public GitHubConnectSection(ISimpleApiClientFactory apiFactory, ITeamExplorerServiceHolder holder, IConnectionManager manager, int index)
90+
public GitHubConnectSection(ISimpleApiClientFactory apiFactory,
91+
ITeamExplorerServiceHolder holder,
92+
IConnectionManager manager,
93+
IPackageSettings packageSettings,
94+
int index)
8795
: base(apiFactory, holder, manager)
8896
{
8997
Title = "GitHub";
9098
IsEnabled = true;
9199
IsVisible = false;
92-
IsExpanded = true;
93100
LoggedIn = false;
94-
95101
sectionIndex = index;
96102

103+
this.packageSettings = packageSettings;
104+
97105
connectionManager.Connections.CollectionChanged += RefreshConnections;
98106
PropertyChanged += OnPropertyChange;
99107
UpdateConnection();
@@ -125,6 +133,7 @@ protected void Refresh(IConnection connection)
125133
if (Repositories != null)
126134
Repositories.CollectionChanged -= UpdateRepositoryList;
127135
Repositories = null;
136+
settings = null;
128137

129138
if (sectionIndex == 0 && ServiceProvider != null)
130139
{
@@ -151,6 +160,9 @@ protected void Refresh(IConnection connection)
151160
LoggedIn = true;
152161
if (ServiceProvider != null)
153162
RefreshRepositories().Forget();
163+
164+
settings = packageSettings.UIState.GetOrCreateConnectSection(Title);
165+
IsExpanded = settings.IsExpanded;
154166
}
155167
}
156168
}
@@ -183,6 +195,8 @@ void OnPropertyChange(object sender, PropertyChangedEventArgs e)
183195
{
184196
if (e.PropertyName == "IsVisible" && IsVisible && View == null)
185197
View = new GitHubConnectContent { DataContext = this };
198+
else if (e.PropertyName == "IsExpanded" && settings != null)
199+
settings.IsExpanded = IsExpanded;
186200
}
187201

188202
async void UpdateRepositoryList(object sender, NotifyCollectionChangedEventArgs e)
@@ -358,6 +372,7 @@ protected override void Dispose(bool disposing)
358372
if (Repositories != null)
359373
Repositories.CollectionChanged -= UpdateRepositoryList;
360374
disposed = true;
375+
packageSettings.Save();
361376
}
362377
}
363378
base.Dispose(disposing);

src/GitHub.TeamFoundation.14/Connect/GitHubConnectSection0.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using GitHub.Api;
22
using GitHub.Models;
33
using GitHub.Services;
4+
using GitHub.Settings;
45
using Microsoft.TeamFoundation.Controls;
56
using System.ComponentModel.Composition;
67

@@ -13,8 +14,11 @@ public class GitHubConnectSection0 : GitHubConnectSection
1314
public const string GitHubConnectSection0Id = "519B47D3-F2A9-4E19-8491-8C9FA25ABE90";
1415

1516
[ImportingConstructor]
16-
public GitHubConnectSection0(ISimpleApiClientFactory apiFactory, ITeamExplorerServiceHolder holder, IConnectionManager manager)
17-
: base(apiFactory, holder, manager, 0)
17+
public GitHubConnectSection0(ISimpleApiClientFactory apiFactory,
18+
ITeamExplorerServiceHolder holder,
19+
IConnectionManager manager,
20+
IPackageSettings settings)
21+
: base(apiFactory, holder, manager, settings, 0)
1822
{
1923
}
2024
}

src/GitHub.TeamFoundation.14/Connect/GitHubConnectSection1.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using GitHub.Api;
22
using GitHub.Models;
33
using GitHub.Services;
4+
using GitHub.Settings;
45
using Microsoft.TeamFoundation.Controls;
56
using System.ComponentModel.Composition;
67

@@ -13,8 +14,11 @@ public class GitHubConnectSection1 : GitHubConnectSection
1314
public const string GitHubConnectSection1Id = "519B47D3-F2A9-4E19-8491-8C9FA25ABE91";
1415

1516
[ImportingConstructor]
16-
public GitHubConnectSection1(ISimpleApiClientFactory apiFactory, ITeamExplorerServiceHolder holder, IConnectionManager manager)
17-
: base(apiFactory, holder, manager, 1)
17+
public GitHubConnectSection1(ISimpleApiClientFactory apiFactory,
18+
ITeamExplorerServiceHolder holder,
19+
IConnectionManager manager,
20+
IPackageSettings settings)
21+
: base(apiFactory, holder, manager, settings, 1)
1822
{
1923
}
2024
}

src/GitHub.UI.Reactive/Controls/Validation/ValidationMessage.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public ValidationMessage()
3333
.Do(CreateBinding)
3434
.Select(control =>
3535
Observable.Merge(
36+
this.WhenAnyValue(x => x.ShowError),
3637
control.Events().TextChanged
3738
.Throttle(TimeSpan.FromSeconds(ShowError ? defaultTextChangeThrottle : TextChangeThrottle),
3839
RxApp.MainThreadScheduler)

src/GitHub.VisualStudio/Base/PackageBase.cs

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)