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

Commit 210e167

Browse files
committed
Started adding "Not a GitHub repository" view
To GitHub pane. XAML compiler crashing on compiling the view though :(
1 parent 004f5f5 commit 210e167

File tree

9 files changed

+112
-6
lines changed

9 files changed

+112
-6
lines changed

src/GitHub.App/GitHub.App.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<DefineConstants>DEBUG;TRACE</DefineConstants>
3131
<ErrorReport>prompt</ErrorReport>
3232
<WarningLevel>4</WarningLevel>
33-
<RunCodeAnalysis>true</RunCodeAnalysis>
33+
<RunCodeAnalysis>false</RunCodeAnalysis>
3434
<CodeAnalysisRuleSet>..\common\GitHubVS.ruleset</CodeAnalysisRuleSet>
3535
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
3636
<CodeAnalysisIgnoreGeneratedCode>true</CodeAnalysisIgnoreGeneratedCode>
@@ -198,6 +198,7 @@
198198
<Compile Include="ViewModels\BaseViewModel.cs" />
199199
<Compile Include="Models\ConnectionRepositoryHostMap.cs" />
200200
<Compile Include="ViewModels\GistCreationViewModel.cs" />
201+
<Compile Include="ViewModels\NotAGitHubRepositoryViewModel.cs" />
201202
<Compile Include="ViewModels\LoggedOutViewModel.cs" />
202203
<Compile Include="ViewModels\LogoutRequiredViewModel.cs" />
203204
<Compile Include="ViewModels\PullRequestCreationViewModel.cs" />
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using System.ComponentModel.Composition;
2+
using GitHub.Exports;
3+
using GitHub.Services;
4+
using ReactiveUI;
5+
6+
namespace GitHub.ViewModels
7+
{
8+
/// <summary>
9+
/// The view model for the "Not a GitHub repository" view in the GitHub pane.
10+
/// </summary>
11+
[ExportViewModel(ViewType = UIViewType.NotAGitHubRepository)]
12+
[PartCreationPolicy(CreationPolicy.NonShared)]
13+
public class NotAGitHubRepositoryViewModel : BaseViewModel, INotAGitHubRepositoryViewModel
14+
{
15+
IUIProvider uiProvider;
16+
17+
/// <summary>
18+
/// Initializes a new instance of the <see cref="NotAGitHubRepositoryViewModel"/> class.
19+
/// </summary>
20+
[ImportingConstructor]
21+
public NotAGitHubRepositoryViewModel(IUIProvider uiProvider)
22+
{
23+
this.uiProvider = uiProvider;
24+
Publish = ReactiveCommand.Create();
25+
}
26+
27+
/// <summary>
28+
/// Gets the command executed when the user clicks the "Publish to GitHub" link.
29+
/// </summary>
30+
public IReactiveCommand<object> Publish { get; }
31+
}
32+
}

src/GitHub.Exports.Reactive/GitHub.Exports.Reactive.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
<Compile Include="Services\IGistPublishService.cs" />
9898
<Compile Include="ViewModels\IGistCreationViewModel.cs" />
9999
<Compile Include="Services\NotificationDispatcher.cs" />
100+
<Compile Include="ViewModels\INotAGitHubRepositoryViewModel.cs" />
100101
<Compile Include="ViewModels\ILoggedOutViewModel.cs" />
101102
<Compile Include="ViewModels\ILogoutRequiredViewModel.cs" />
102103
<Compile Include="ViewModels\ILoginControlViewModel.cs" />
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Reactive;
3+
using ReactiveUI;
4+
5+
namespace GitHub.ViewModels
6+
{
7+
/// <summary>
8+
/// Defines the view model for the "Sign in to GitHub" view in the GitHub pane.
9+
/// </summary>
10+
public interface INotAGitHubRepositoryViewModel : IViewModel
11+
{
12+
/// <summary>
13+
/// Gets the command executed when the user clicks the "Publish to GitHub" link.
14+
/// </summary>
15+
IReactiveCommand<object> Publish { get; }
16+
}
17+
}

src/GitHub.Exports/Exports/ExportMetadata.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ public enum UIViewType
2525
PRCreation,
2626
LogoutRequired,
2727
GitHubPane,
28-
LoggedOut
28+
LoggedOut,
29+
NotAGitHubRepository,
2930
}
3031

3132
public enum MenuType

src/GitHub.VisualStudio/GitHub.VisualStudio.csproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,9 @@
274274
<DependentUpon>GitHubPaneView.xaml</DependentUpon>
275275
</Compile>
276276
<Compile Include="UI\Views\GitHubPaneViewModel.cs" />
277+
<Compile Include="UI\Views\NotAGitHubRepositoryView.xaml.cs">
278+
<DependentUpon>NotAGitHubRepositoryView.xaml</DependentUpon>
279+
</Compile>
277280
<Compile Include="UI\Views\LoggedOutView.xaml.cs">
278281
<DependentUpon>LoggedOutView.xaml</DependentUpon>
279282
</Compile>
@@ -469,6 +472,10 @@
469472
<SubType>Designer</SubType>
470473
<Generator>MSBuild:Compile</Generator>
471474
</Page>
475+
<Page Include="UI\Views\NotAGitHubRepositoryView.xaml">
476+
<Generator>MSBuild:Compile</Generator>
477+
<SubType>Designer</SubType>
478+
</Page>
472479
<Page Include="UI\Views\LoggedOutView.xaml">
473480
<SubType>Designer</SubType>
474481
<Generator>MSBuild:Compile</Generator>

src/GitHub.VisualStudio/UI/Views/GitHubPaneViewModel.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,11 @@ async Task Reload([AllowNull] ViewWithData data = null, bool navigating = false)
120120
{
121121
if (uiController != null)
122122
{
123-
Stop();
124-
//var factory = ServiceProvider.GetExportedValue<IUIFactory>();
125-
//var c = factory.CreateViewAndViewModel(UIViewType.LoggedOut);
126-
//Control = c.View;
123+
var factory = ServiceProvider.GetExportedValue<IUIFactory>();
124+
var c = factory.CreateViewAndViewModel(UIViewType.NotAGitHubRepository);
125+
Control = c.View;
127126
}
127+
128128
return;
129129
}
130130

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<local:GenericNotAGitHubRepositoryView x:Class="GitHub.VisualStudio.UI.Views.NotAGitHubRepositoryView"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:cache="clr-namespace:GitHub.VisualStudio.Helpers"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:local="clr-namespace:GitHub.VisualStudio.UI.Views"
7+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8+
xmlns:ui="clr-namespace:GitHub.UI;assembly=GitHub.UI"
9+
DataContext="{Binding ViewModel}"
10+
d:DesignHeight="300"
11+
d:DesignWidth="300"
12+
mc:Ignorable="d">
13+
14+
<UserControl.Resources>
15+
<ResourceDictionary>
16+
<ResourceDictionary.MergedDictionaries>
17+
<cache:SharedDictionaryManager Source="pack://application:,,,/GitHub.VisualStudio;component/SharedDictionary.xaml" />
18+
<cache:SharedDictionaryManager Source="pack://application:,,,/GitHub.UI;component/SharedDictionary.xaml" />
19+
<cache:SharedDictionaryManager Source="pack://application:,,,/GitHub.VisualStudio;component/Styles/GitHubActionLink.xaml" />
20+
</ResourceDictionary.MergedDictionaries>
21+
</ResourceDictionary>
22+
</UserControl.Resources>
23+
24+
Not a GitHub repository.
25+
</local:GenericNotAGitHubRepositoryView>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using System.ComponentModel.Composition;
2+
using GitHub.Exports;
3+
using GitHub.UI;
4+
using GitHub.ViewModels;
5+
6+
namespace GitHub.VisualStudio.UI.Views
7+
{
8+
public class GenericNotAGitHubRepositoryView : SimpleViewUserControl<INotAGitHubRepositoryViewModel, GenericNotAGitHubRepositoryView>
9+
{
10+
}
11+
12+
[ExportView(ViewType = UIViewType.NotAGitHubRepository)]
13+
[PartCreationPolicy(CreationPolicy.NonShared)]
14+
15+
public partial class NotAGitHubRepositoryView : GenericNotAGitHubRepositoryView
16+
{
17+
public NotAGitHubRepositoryView()
18+
{
19+
this.InitializeComponent();
20+
}
21+
}
22+
}

0 commit comments

Comments
 (0)