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

Commit d98332b

Browse files
committed
Merge feature/pr/views into release/1.0.99
2 parents ff77fe5 + 6737423 commit d98332b

23 files changed

+445
-468
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

src/GitHub.App/SampleData/SampleViewModels.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,20 @@ public RepositoryCreationViewModelDesigner()
4040
RepositoryName = "Hello-World";
4141
Description = "A description";
4242
KeepPrivate = true;
43+
CanKeepPrivate = true;
4344
Accounts = new ReactiveList<IAccount>
4445
{
4546
new AccountDesigner { Login = "shana" },
4647
new AccountDesigner { Login = "GitHub", IsUser = false }
4748
};
49+
SelectedAccount = Accounts[0];
4850
GitIgnoreTemplates = new ReactiveList<GitIgnoreItem>
4951
{
5052
GitIgnoreItem.Create("VisualStudio"),
5153
GitIgnoreItem.Create("Wap"),
5254
GitIgnoreItem.Create("WordPress")
5355
};
54-
56+
SelectedGitIgnoreTemplate = GitIgnoreTemplates[0];
5557
Licenses = new ReactiveList<LicenseItem>
5658
{
5759
new LicenseItem("agpl-3.0", "GNU Affero GPL v3.0"),
@@ -60,16 +62,15 @@ public RepositoryCreationViewModelDesigner()
6062
new LicenseItem("mit", "MIT License")
6163
};
6264

63-
SelectedLicense = LicenseItem.None;
64-
SelectedGitIgnoreTemplate = null;
65+
SelectedLicense = Licenses[0];
6566
}
6667

6768
public new string Title { get { return "Create a GitHub Repository"; } } // TODO: this needs to be contextual
6869

6970
public IReadOnlyList<IAccount> Accounts
7071
{
7172
get;
72-
private set;
73+
set;
7374
}
7475

7576
public string BaseRepositoryPath
@@ -223,7 +224,7 @@ public void Dispose()
223224

224225
public RepositoryPublishViewModelDesigner()
225226
{
226-
Connections = new ReactiveList<IConnection>
227+
Connections = new ObservableCollection<IConnection>
227228
{
228229
new Conn() { HostAddress = new HostAddress() },
229230
new Conn() { HostAddress = HostAddress.Create("ghe.io") }
@@ -259,7 +260,7 @@ public IReactiveCommand<ProgressState> PublishRepository
259260
private set;
260261
}
261262

262-
public ReactiveList<IConnection> Connections
263+
public ObservableCollection<IConnection> Connections
263264
{
264265
get;
265266
private set;

src/GitHub.App/ViewModels/RepositoryPublishViewModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public RepositoryPublishViewModel(
5252
)
5353
.ToProperty(this, x => x.Title);
5454

55-
Connections = new ReactiveList<IConnection>(connectionManager.Connections);
55+
Connections = connectionManager.Connections;
5656
this.repositoryPublishService = repositoryPublishService;
5757

5858
if (Connections.Any())
@@ -112,7 +112,7 @@ public RepositoryPublishViewModel(
112112
public bool IsPublishing { get { return isPublishing.Value; } }
113113

114114
public IReactiveCommand<ProgressState> PublishRepository { get; private set; }
115-
public ReactiveList<IConnection> Connections { get; private set; }
115+
public ObservableCollection<IConnection> Connections { get; private set; }
116116

117117
IConnection selectedConnection;
118118
[AllowNull]

src/GitHub.Exports.Reactive/ViewModels/IRepositoryPublishViewModel.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
using System.Reactive;
22
using GitHub.Models;
33
using ReactiveUI;
4+
using System.Collections.ObjectModel;
45

56
namespace GitHub.ViewModels
67
{
78
public interface IRepositoryPublishViewModel : IRepositoryForm
89
{
9-
ReactiveList<IConnection> Connections { get; }
10+
ObservableCollection<IConnection> Connections { get; }
1011

1112
/// <summary>
1213
/// Command that creates the repository.

src/GitHub.TeamFoundation.14/Sync/GitHubPublishSection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
using GitHub.VisualStudio.TeamExplorer;
1616
using System.Windows.Controls;
1717
using GitHub.VisualStudio.UI;
18+
using GitHub.ViewModels;
1819

1920
namespace GitHub.VisualStudio.TeamExplorer.Sync
2021
{
@@ -126,7 +127,6 @@ void ShowPublish()
126127
{
127128
var c = data.View;
128129
SectionContent = c;
129-
((UserControl)c).DataContext = this;
130130
c.IsBusy.Subscribe(x => IsBusy = x);
131131
},
132132
() =>

src/GitHub.UI.Reactive/Controls/SimpleViewUserControl.cs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,19 +88,24 @@ public void Dispose()
8888
}
8989
}
9090

91-
public class SimpleViewUserControl<TViewModel, TImplementor> : SimpleViewUserControl, IViewFor<TViewModel>, IView
92-
where TViewModel : class, IViewModel
91+
public class SimpleViewUserControl<TInterface, TImplementor> : SimpleViewUserControl, IViewFor<TInterface>, IView
92+
where TInterface : class, IViewModel
9393
where TImplementor : class
9494
{
95+
public SimpleViewUserControl()
96+
{
97+
DataContextChanged += (s, e) => ViewModel = (TInterface)e.NewValue;
98+
}
99+
95100
public static readonly DependencyProperty ViewModelProperty = DependencyProperty.Register(
96-
"ViewModel", typeof(TViewModel), typeof(TImplementor), new PropertyMetadata(null));
101+
"ViewModel", typeof(TInterface), typeof(TImplementor), new PropertyMetadata(null));
97102

98103
[AllowNull]
99104
object IViewFor.ViewModel
100105
{
101106
[return:AllowNull]
102107
get { return ViewModel; }
103-
set { ViewModel = (TViewModel)value; }
108+
set { ViewModel = (TInterface)value; }
104109
}
105110

106111
[AllowNull]
@@ -111,15 +116,15 @@ IViewModel IView.ViewModel
111116
}
112117

113118
[AllowNull]
114-
public TViewModel ViewModel
119+
public TInterface ViewModel
115120
{
116121
[return: AllowNull]
117-
get { return (TViewModel)GetValue(ViewModelProperty); }
122+
get { return (TInterface)GetValue(ViewModelProperty); }
118123
set { SetValue(ViewModelProperty, value); }
119124
}
120125

121126
[AllowNull]
122-
TViewModel IViewFor<TViewModel>.ViewModel
127+
TInterface IViewFor<TInterface>.ViewModel
123128
{
124129
[return: AllowNull]
125130
get { return ViewModel; }

src/GitHub.UI/Behaviours/AddEmptyItemToList.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,13 @@ protected override void OnAttached()
3333
return;
3434
defaultValue = PropertyPathHelper.GetValue(binding.ResolvedSource, binding.ResolvedSourcePropertyName);
3535
}
36-
dynamic items = AssociatedObject.ItemsSource;
37-
var list = items as IList;
36+
var list = AssociatedObject.ItemsSource as IList;
3837
Debug.Assert(list != null, "ItemsSource data source is not an IList, cannot change it.");
3938
if (list == null)
4039
return;
4140
try
4241
{
43-
items.Insert(0, defaultValue);
42+
list.Insert(0, defaultValue);
4443
}
4544
catch (Exception ex)
4645
{
@@ -53,14 +52,13 @@ protected override void OnAttached()
5352
}
5453
else if (AssociatedObject.SelectedIndex == 0)
5554
{
56-
dynamic items = AssociatedObject.ItemsSource;
57-
var list = items as IList;
55+
var list = AssociatedObject.ItemsSource as IList;
5856
Debug.Assert(list != null, "ItemsSource data source is not an IList, cannot change it.");
59-
Debug.Assert(list.Count == 0, "ItemsSource data source is empty, something went wrong.");
57+
Debug.Assert(list.Count > 0, "ItemsSource data source is empty, something went wrong.");
6058
if (list == null || list.Count == 0)
6159
return;
62-
if (items[0] == defaultValue)
63-
items.RemoveAt(0);
60+
if (list[0] == defaultValue)
61+
list.RemoveAt(0);
6462
}
6563
}
6664
if (e.RemovedItems.Count > 0)

src/GitHub.VisualStudio/Converters/CountToVisibilityConverter.cs renamed to src/GitHub.UI/Converters/CountToVisibilityConverter.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,18 @@
44
using System.Windows.Data;
55
using NullGuard;
66

7-
namespace GitHub.VisualStudio.Converters
7+
namespace GitHub.UI
88
{
99
/// <summary>
1010
/// Convert a count to visibility based on the following rule:
1111
/// * If count == 0, return Visibility.Visible
1212
/// * If count > 0, return Visibility.Collapsed
1313
/// </summary>
14-
public class CountToVisibilityConverter : IValueConverter
14+
public class CountToVisibilityConverter : ValueConverterMarkupExtension<CountToVisibilityConverter>
1515
{
16-
public object Convert(object value, Type targetType, [AllowNull] object parameter, [AllowNull] CultureInfo culture)
16+
public override object Convert(object value, Type targetType, [AllowNull] object parameter, [AllowNull] CultureInfo culture)
1717
{
1818
return ((int)value == 0) ? Visibility.Visible : Visibility.Collapsed;
1919
}
20-
21-
[return: AllowNull]
22-
public object ConvertBack(object value, Type targetType, [AllowNull] object parameter, [AllowNull] CultureInfo culture)
23-
{
24-
return null;
25-
}
2620
}
2721
}

src/GitHub.UI/GitHub.UI.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
<DesignTime>True</DesignTime>
8686
<DependentUpon>OcticonPaths.resx</DependentUpon>
8787
</Compile>
88+
<Compile Include="Converters\CountToVisibilityConverter.cs" />
8889
<Compile Include="Converters\DefaultValueConverter.cs" />
8990
<Compile Include="Converters\StickieListItemConverter.cs" />
9091
<Compile Include="Resources.Designer.cs">

src/GitHub.VisualStudio/GitHub.VisualStudio.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@
204204
<Link>Properties\SolutionInfo.cs</Link>
205205
</Compile>
206206
<Compile Include="Base\MenuBase.cs" />
207-
<Compile Include="Converters\CountToVisibilityConverter.cs" />
208207
<Compile Include="..\common\SharedDictionaryManager.cs">
209208
<Link>Helpers\SharedDictionaryManager.cs</Link>
210209
</Compile>

0 commit comments

Comments
 (0)