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

Commit 0aec503

Browse files
committed
Merge feature/pr/views into pr-list-polish
2 parents 88d1d2d + b24b202 commit 0aec503

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+728
-596
lines changed

GitHubVS.sln

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 14
4-
VisualStudioVersion = 14.0.24720.0
4+
VisualStudioVersion = 14.0.25029.0
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitHub.VisualStudio", "src\GitHub.VisualStudio\GitHub.VisualStudio.csproj", "{11569514-5AE5-4B5B-92A2-F10B0967DE5F}"
77
EndProject
@@ -42,23 +42,22 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Script", "Script", "{7B6C5F
4242
ProjectSection(SolutionItems) = preProject
4343
.gitattributes = .gitattributes
4444
.gitignore = .gitignore
45+
script\Announce.ps1 = script\Announce.ps1
4546
script\Bootstrap.ps1 = script\Bootstrap.ps1
4647
build.cmd = build.cmd
4748
script\Bump-Version.ps1 = script\Bump-Version.ps1
4849
script\cibuild.ps1 = script\cibuild.ps1
4950
script\common.ps1 = script\common.ps1
5051
script\Deploy.ps1 = script\Deploy.ps1
5152
script\Get-CheckedOutBranch.ps1 = script\Get-CheckedOutBranch.ps1
53+
script\Get-HeadSha1.ps1 = script\Get-HeadSha1.ps1
5254
script\HubotTell-NativeRoom.ps1 = script\HubotTell-NativeRoom.ps1
5355
nuget.config = nuget.config
5456
script\Require-CleanWorkTree.ps1 = script\Require-CleanWorkTree.ps1
55-
script\SolutionInfo.cs = script\SolutionInfo.cs
56-
script\Upload-DirectoryToS3.ps1 = script\Upload-DirectoryToS3.ps1
57-
script\Announce.ps1 = script\Announce.ps1
58-
script\Get-HeadSha1.ps1 = script\Get-HeadSha1.ps1
5957
script\Run-NUnit.ps1 = script\Run-NUnit.ps1
6058
script\Run-XUnit.ps1 = script\Run-XUnit.ps1
61-
59+
script\SolutionInfo.cs = script\SolutionInfo.cs
60+
script\Upload-DirectoryToS3.ps1 = script\Upload-DirectoryToS3.ps1
6261
EndProjectSection
6362
EndProject
6463
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{8A7DA2E7-262B-4581-807A-1C45CE79CDFD}"
@@ -545,8 +544,8 @@ Global
545544
{161DBF01-1DBF-4B00-8551-C5C00F26720D}.Release|Any CPU.Build.0 = Release|Any CPU
546545
{161DBF01-1DBF-4B00-8551-C5C00F26720D}.Release|x86.ActiveCfg = Release|Any CPU
547546
{161DBF01-1DBF-4B00-8551-C5C00F26720D}.Release|x86.Build.0 = Release|Any CPU
548-
{161DBF01-1DBF-4B00-8551-C5C00F26720D}.XamlDesign|Any CPU.ActiveCfg = Release|Any CPU
549-
{161DBF01-1DBF-4B00-8551-C5C00F26720D}.XamlDesign|Any CPU.Build.0 = Release|Any CPU
547+
{161DBF01-1DBF-4B00-8551-C5C00F26720D}.XamlDesign|Any CPU.ActiveCfg = Debug|Any CPU
548+
{161DBF01-1DBF-4B00-8551-C5C00F26720D}.XamlDesign|Any CPU.Build.0 = Debug|Any CPU
550549
{161DBF01-1DBF-4B00-8551-C5C00F26720D}.XamlDesign|x86.ActiveCfg = Release|Any CPU
551550
{161DBF01-1DBF-4B00-8551-C5C00F26720D}.XamlDesign|x86.Build.0 = Release|Any CPU
552551
{161DBF01-1DBF-4B00-8551-C5C00F26720E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
@@ -561,8 +560,8 @@ Global
561560
{161DBF01-1DBF-4B00-8551-C5C00F26720E}.Release|Any CPU.Build.0 = Release|Any CPU
562561
{161DBF01-1DBF-4B00-8551-C5C00F26720E}.Release|x86.ActiveCfg = Release|Any CPU
563562
{161DBF01-1DBF-4B00-8551-C5C00F26720E}.Release|x86.Build.0 = Release|Any CPU
564-
{161DBF01-1DBF-4B00-8551-C5C00F26720E}.XamlDesign|Any CPU.ActiveCfg = Release|Any CPU
565-
{161DBF01-1DBF-4B00-8551-C5C00F26720E}.XamlDesign|Any CPU.Build.0 = Release|Any CPU
563+
{161DBF01-1DBF-4B00-8551-C5C00F26720E}.XamlDesign|Any CPU.ActiveCfg = Debug|Any CPU
564+
{161DBF01-1DBF-4B00-8551-C5C00F26720E}.XamlDesign|Any CPU.Build.0 = Debug|Any CPU
566565
{161DBF01-1DBF-4B00-8551-C5C00F26720E}.XamlDesign|x86.ActiveCfg = Release|Any CPU
567566
{161DBF01-1DBF-4B00-8551-C5C00F26720E}.XamlDesign|x86.Build.0 = Release|Any CPU
568567
{D1DFBB0C-B570-4302-8F1E-2E3A19C41961}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
@@ -577,8 +576,8 @@ Global
577576
{D1DFBB0C-B570-4302-8F1E-2E3A19C41961}.Release|Any CPU.Build.0 = Release|Any CPU
578577
{D1DFBB0C-B570-4302-8F1E-2E3A19C41961}.Release|x86.ActiveCfg = Release|Any CPU
579578
{D1DFBB0C-B570-4302-8F1E-2E3A19C41961}.Release|x86.Build.0 = Release|Any CPU
580-
{D1DFBB0C-B570-4302-8F1E-2E3A19C41961}.XamlDesign|Any CPU.ActiveCfg = Release|Any CPU
581-
{D1DFBB0C-B570-4302-8F1E-2E3A19C41961}.XamlDesign|Any CPU.Build.0 = Release|Any CPU
579+
{D1DFBB0C-B570-4302-8F1E-2E3A19C41961}.XamlDesign|Any CPU.ActiveCfg = Debug|Any CPU
580+
{D1DFBB0C-B570-4302-8F1E-2E3A19C41961}.XamlDesign|Any CPU.Build.0 = Debug|Any CPU
582581
{D1DFBB0C-B570-4302-8F1E-2E3A19C41961}.XamlDesign|x86.ActiveCfg = Release|Any CPU
583582
{D1DFBB0C-B570-4302-8F1E-2E3A19C41961}.XamlDesign|x86.Build.0 = Release|Any CPU
584583
EndGlobalSection

script

src/GitHub.App/Factories/HostCacheFactory.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,23 @@ public IBlobCache Create(HostAddress hostAddress)
3939

4040
IOperatingSystem OperatingSystem { get { return operatingSystem.Value; } }
4141
IBlobCacheFactory BlobCacheFactory { get { return blobCacheFactory.Value; } }
42+
43+
bool disposed;
44+
protected virtual void Dispose(bool disposing)
45+
{
46+
if (disposing)
47+
{
48+
if (disposed) return;
49+
disposed = true;
50+
if (blobCacheFactory.IsValueCreated)
51+
blobCacheFactory.Value.Dispose();
52+
}
53+
}
54+
55+
public void Dispose()
56+
{
57+
Dispose(true);
58+
GC.SuppressFinalize(this);
59+
}
4260
}
4361
}

src/GitHub.App/Factories/IBlobCacheFactory.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
using Akavache;
2+
using System;
23

34
namespace GitHub.Factories
45
{
5-
public interface IBlobCacheFactory
6+
public interface IBlobCacheFactory : IDisposable
67
{
78
IBlobCache CreateBlobCache(string path);
89
}

src/GitHub.App/Factories/IHostCacheFactory.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
using Akavache;
22
using GitHub.Primitives;
3+
using System;
34

45
namespace GitHub.Factories
56
{
6-
public interface IHostCacheFactory
7+
public interface IHostCacheFactory : IDisposable
78
{
89
IBlobCache Create(HostAddress hostAddress);
910
}

src/GitHub.App/Factories/RepositoryHostFactory.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ protected virtual void Dispose(bool disposing)
5151

5252
loginCache.Dispose();
5353
avatarProvider.Dispose();
54+
hostCacheFactory.Dispose();
5455
disposed = true;
5556
}
5657
}

src/GitHub.App/Factories/SqlitePersistentBlobCacheFactory.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44
using System;
55
using System.Collections.Generic;
66
using System.ComponentModel.Composition;
7+
using System.Reactive.Disposables;
78

89
namespace GitHub.Factories
910
{
1011
[Export(typeof(IBlobCacheFactory))]
1112
[PartCreationPolicy(CreationPolicy.Shared)]
1213
public class SqlitePersistentBlobCacheFactory : IBlobCacheFactory
1314
{
15+
readonly CompositeDisposable disposables = new CompositeDisposable();
1416
static readonly Logger log = LogManager.GetCurrentClassLogger();
1517
Dictionary<string, IBlobCache> cache = new Dictionary<string, IBlobCache>();
1618

@@ -24,6 +26,7 @@ public IBlobCache CreateBlobCache(string path)
2426
{
2527
var c = new SQLitePersistentBlobCache(path);
2628
cache.Add(path, c);
29+
disposables.Add(c);
2730
return c;
2831
}
2932
catch(Exception ex)
@@ -32,5 +35,23 @@ public IBlobCache CreateBlobCache(string path)
3235
return new InMemoryBlobCache();
3336
}
3437
}
38+
39+
bool disposed;
40+
protected virtual void Dispose(bool disposing)
41+
{
42+
if (disposing)
43+
{
44+
if (disposed) return;
45+
disposed = true;
46+
disposables.Dispose();
47+
}
48+
}
49+
50+
public void Dispose()
51+
{
52+
Dispose(true);
53+
GC.SuppressFinalize(this);
54+
}
55+
3556
}
3657
}

src/GitHub.App/Factories/UIFactory.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ public IUIPair CreateViewAndViewModel(UIViewType viewType)
4343
/// </summary>
4444
public class UIPair : IUIPair
4545
{
46-
ExportLifetimeContext<IView> view;
47-
ExportLifetimeContext<IViewModel> viewModel;
48-
CompositeDisposable handlers = new CompositeDisposable();
49-
UIViewType viewType;
46+
readonly ExportLifetimeContext<IView> view;
47+
readonly ExportLifetimeContext<IViewModel> viewModel;
48+
readonly CompositeDisposable handlers = new CompositeDisposable();
49+
readonly UIViewType viewType;
5050

5151
public UIViewType ViewType => viewType;
5252
public IView View => view.Value;
@@ -88,9 +88,7 @@ void Dispose(bool disposing)
8888
if (!handlers.IsDisposed)
8989
handlers.Dispose();
9090
view?.Dispose();
91-
view = null;
9291
viewModel?.Dispose();
93-
viewModel = null;
9492
disposed = true;
9593
}
9694
}

src/GitHub.App/GitHub.App.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131
<Compile Include="SampleData\AccountDesigner.cs" />
132132
<Compile Include="SampleData\PullRequestCreationViewModelDesigner.cs" />
133133
<Compile Include="SampleData\PullRequestDetailViewModelDesigner.cs" />
134+
<Compile Include="SampleData\LoggedOutViewModelDesigner.cs" />
134135
<Compile Include="SampleData\PullRequestListViewModelDesigner.cs" />
135136
<Compile Include="Services\AvatarProvider.cs" />
136137
<Compile Include="Services\GitHubCredentialProvider.cs" />
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System;
2+
using System.Diagnostics.CodeAnalysis;
3+
using System.Reactive.Linq;
4+
using System.Windows.Input;
5+
using GitHub.Collections;
6+
using GitHub.Models;
7+
using GitHub.ViewModels;
8+
9+
namespace GitHub.SampleData
10+
{
11+
[ExcludeFromCodeCoverage]
12+
public class LoggedOutViewModelDesigner : BaseViewModelDesigner, IViewModel
13+
{
14+
public LoggedOutViewModelDesigner()
15+
{
16+
}
17+
}
18+
}

0 commit comments

Comments
 (0)