зеркало из https://github.com/github/VisualStudio.git
Move interface to GitHub.Exports
Also changed the home section to bind to the DataContext and use the DataContext to set the ViewModel.
This commit is contained in:
Родитель
e598b8d4ff
Коммит
4264cde870
|
@ -74,7 +74,6 @@
|
|||
<ApplicationDefinition Include="App.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="MainWindowViewModel.cs" />
|
||||
<Compile Include="WindowController.xaml.cs">
|
||||
<DependentUpon>WindowController.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
|
|
@ -22,10 +22,7 @@
|
|||
|
||||
<StackPanel>
|
||||
<Border Background="#F5F5F5" >
|
||||
<gh:GitHubHomeContent
|
||||
x:Name="gitHubHomeSection"
|
||||
Margin="0,10,0,10"
|
||||
d:DataContext="{d:DesignInstance local:HomeContentDesignContext, IsDesignTimeCreatable=True}" />
|
||||
<gh:GitHubHomeContent x:Name="gitHubHomeSection" Margin="0,10,0,10" />
|
||||
</Border>
|
||||
<Grid>
|
||||
<WrapPanel Orientation="Horizontal" Grid.Row="0" Margin="0,0,0,6">
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Windows;
|
||||
using GitHub.SampleData;
|
||||
using GitHub.Services;
|
||||
using GitHub.UI;
|
||||
using GitHub.VisualStudio;
|
||||
|
@ -14,7 +15,7 @@ namespace DesignTimeStyleHelper
|
|||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
gitHubHomeSection.ViewModel = new DesignTimeGitHubHomeSection();
|
||||
gitHubHomeSection.DataContext = new GitHubHomeSectionDesigner();
|
||||
}
|
||||
|
||||
private void cloneLink_Click(object sender, RoutedEventArgs e)
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
using System;
|
||||
using GitHub.UI;
|
||||
using GitHub.VisualStudio.TeamExplorerHome;
|
||||
|
||||
namespace DesignTimeStyleHelper
|
||||
{
|
||||
public class HomeContentDesignContext
|
||||
{
|
||||
public DesignTimeGitHubHomeSection ViewModel { get { return new DesignTimeGitHubHomeSection(); } }
|
||||
}
|
||||
|
||||
public class DesignTimeGitHubHomeSection : IGitHubHomeSection
|
||||
{
|
||||
public Octicon Icon { get { return Octicon.@lock; } }
|
||||
|
||||
public string RepoName { get { return "octokit/octokit.net"; } set { } }
|
||||
public string RepoUrl { get { return "https://github.com/octokit/octokit.net"; } set { } }
|
||||
}
|
||||
}
|
|
@ -8,8 +8,10 @@ using GitHub.Helpers;
|
|||
using GitHub.Models;
|
||||
using GitHub.Primitives;
|
||||
using GitHub.Services;
|
||||
using GitHub.UI;
|
||||
using GitHub.Validation;
|
||||
using GitHub.ViewModels;
|
||||
using GitHub.VisualStudio.TeamExplorerHome;
|
||||
using Octokit;
|
||||
using ReactiveUI;
|
||||
using Account = Octokit.Account;
|
||||
|
@ -190,4 +192,32 @@ namespace GitHub.SampleData
|
|||
|
||||
public bool IsPrivate { get; set; }
|
||||
}
|
||||
|
||||
public class GitHubHomeSectionDesigner : IGitHubHomeSection
|
||||
{
|
||||
public GitHubHomeSectionDesigner()
|
||||
{
|
||||
Icon = Octicon.@lock;
|
||||
RepoName = "octokit";
|
||||
RepoUrl = "https://github.com/octokit/octokit.net";
|
||||
}
|
||||
|
||||
public Octicon Icon
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public string RepoName
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public string RepoUrl
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,6 +59,8 @@
|
|||
<ItemGroup>
|
||||
<Compile Include="Authentication\AuthenticationResultExtensions.cs" />
|
||||
<Compile Include="Helpers\ImageHelper.cs" />
|
||||
<Compile Include="UI\Octicon.cs" />
|
||||
<Compile Include="ViewModels\IGitHubHomeSection.cs" />
|
||||
<Compile Include="Models\IProgram.cs" />
|
||||
<Compile Include="Api\ISimpleApiClient.cs" />
|
||||
<Compile Include="Api\ISimpleApiClientFactory.cs" />
|
||||
|
|
|
@ -128,6 +128,10 @@
|
|||
<Project>{e4ed0537-d1d9-44b6-9212-3096d7c3f7a1}</Project>
|
||||
<Name>GitHub.Exports.Reactive</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\GitHub.Exports\GitHub.Exports.csproj">
|
||||
<Project>{9aea02db-02b5-409c-b0ca-115d05331a6b}</Project>
|
||||
<Name>GitHub.Exports</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\GitHub.Extensions.Reactive\GitHub.Extensions.Reactive.csproj">
|
||||
<Project>{6559E128-8B40-49A5-85A8-05565ED0C7E3}</Project>
|
||||
<Name>GitHub.Extensions.Reactive</Name>
|
||||
|
|
|
@ -65,7 +65,6 @@
|
|||
<Compile Include="Controls\HorizontalShadowDivider.xaml.cs">
|
||||
<DependentUpon>HorizontalShadowDivider.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Controls\Octicons\Octicon.cs" />
|
||||
<Compile Include="Controls\Octicons\OcticonImage.cs" />
|
||||
<Compile Include="Controls\Octicons\OcticonPath.cs" />
|
||||
<Compile Include="Controls\Octicons\OcticonPaths.Designer.cs" />
|
||||
|
@ -174,7 +173,15 @@
|
|||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Controls\Octicons\OcticonPaths.resx" />
|
||||
<EmbeddedResource Include="Controls\Octicons\OcticonPaths.resx">
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\GitHub.Exports\GitHub.Exports.csproj">
|
||||
<Project>{9aea02db-02b5-409c-b0ca-115d05331a6b}</Project>
|
||||
<Name>GitHub.Exports</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
|
|
@ -198,7 +198,6 @@
|
|||
<Compile Include="TeamExplorerConnect\PlaceholderGitHubSection.cs" />
|
||||
<Compile Include="TeamExplorerHome\GitHubHomeSection.cs" />
|
||||
<Compile Include="TeamExplorerHome\GraphsNavigationItem.cs" />
|
||||
<Compile Include="TeamExplorerHome\IGitHubHomeSection.cs" />
|
||||
<Compile Include="TeamExplorerHome\PullRequestsNavigationItem.cs" />
|
||||
<Compile Include="TeamExplorerHome\IssuesNavigationItem.cs" />
|
||||
<Compile Include="TeamExplorerHome\WikiNavigationItem.cs" />
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace GitHub.VisualStudio.TeamExplorerHome
|
|||
IsVisible = false;
|
||||
IsExpanded = true;
|
||||
View = new GitHubHomeContent();
|
||||
View.ViewModel = this;
|
||||
View.DataContext = this;
|
||||
}
|
||||
|
||||
protected override void ContextChanged(object sender, ContextChangedEventArgs e)
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:GitHub.VisualStudio.UI.Views"
|
||||
xmlns:sampleData="clr-namespace:GitHub.SampleData;assembly=GitHub.App"
|
||||
xmlns:ui="clr-namespace:GitHub.UI;assembly=GitHub.UI"
|
||||
xmlns:vsshell="clr-namespace:Microsoft.VisualStudio.Shell;assembly=Microsoft.VisualStudio.Shell.12.0"
|
||||
xmlns:vs="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Shell.12.0"
|
||||
|
@ -12,14 +13,22 @@
|
|||
Height="48"
|
||||
d:DesignWidth="300"
|
||||
Background="{DynamicResource {x:Static vsshell:VsBrushes.ToolWindowBackgroundKey}}"
|
||||
DataContext="{Binding RelativeSource={RelativeSource Self}}">
|
||||
DataContext="{Binding ViewModel}">
|
||||
<d:DesignProperties.DataContext>
|
||||
<Binding>
|
||||
<Binding.Source>
|
||||
<sampleData:GitHubHomeSectionDesigner />
|
||||
</Binding.Source>
|
||||
</Binding>
|
||||
</d:DesignProperties.DataContext>
|
||||
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/GitHub.UI;component/Assets/Controls.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<Style TargetType="Label">
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static vsshell:VsBrushes.GrayTextKey }}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static vsshell:VsBrushes.ToolWindowTextKey}}" />
|
||||
<Setter Property="Padding" Value="0" />
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
|
@ -33,11 +42,11 @@
|
|||
Width="32"
|
||||
VerticalAlignment="Center"
|
||||
Margin="18,6,8,8"
|
||||
Icon="lock"
|
||||
Icon="lock"
|
||||
Foreground="{Binding BorderBrush, RelativeSource={RelativeSource AncestorType={x:Type ListBoxItem}}, FallbackValue=Gray}" />
|
||||
<StackPanel Orientation="Vertical" Margin="0">
|
||||
<Label Content="{Binding Path=ViewModel.RepoName}" />
|
||||
<Label Content="{Binding Path=ViewModel.RepoUrl}" />
|
||||
<Label Content="{Binding Path=RepoName}" />
|
||||
<Label Content="{Binding Path=RepoUrl}" Foreground="{DynamicResource {x:Static vsshell:VsBrushes.GrayTextKey }}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
|
|
|
@ -12,6 +12,8 @@ namespace GitHub.VisualStudio.UI.Views
|
|||
public GitHubHomeContent()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
DataContextChanged += (s, e) => ViewModel = e.NewValue as IGitHubHomeSection;
|
||||
}
|
||||
|
||||
public IGitHubHomeSection ViewModel
|
||||
|
|
Загрузка…
Ссылка в новой задаче