зеркало из https://github.com/github/VisualStudio.git
Temporary TE section for triggering clone/create
While we don't have the definitive classes/interfaces for the GitHub Connect section in Team Explorer, use a mock one that triggers our clone/create dialogs (with optional auth)
This commit is contained in:
Родитель
daca32e477
Коммит
7d864f16df
|
@ -0,0 +1,70 @@
|
||||||
|
using GitHub.Exports;
|
||||||
|
using GitHub.Extensions;
|
||||||
|
using GitHub.Models;
|
||||||
|
using GitHub.Services;
|
||||||
|
using GitHub.VisualStudio.UI.Views;
|
||||||
|
using Microsoft.TeamFoundation.Controls;
|
||||||
|
using Microsoft.VisualStudio.Shell;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.Composition;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace GitHub.VisualStudio.TeamExplorerConnect
|
||||||
|
{
|
||||||
|
[TeamExplorerSection(PlaceholderGitHubSectionId, TeamExplorerPageIds.Connect, 10)]
|
||||||
|
public class PlaceholderGitHubSection : TeamExplorerSectionBase
|
||||||
|
{
|
||||||
|
public const string PlaceholderGitHubSectionId = "519B47D3-F2A9-4E19-8491-8C9FA25ABE97";
|
||||||
|
|
||||||
|
protected GitHubConnectContent View
|
||||||
|
{
|
||||||
|
get { return this.SectionContent as GitHubConnectContent; }
|
||||||
|
set { this.SectionContent = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
[ImportingConstructor]
|
||||||
|
public PlaceholderGitHubSection([Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider)
|
||||||
|
{
|
||||||
|
|
||||||
|
this.Title = "GitHub";
|
||||||
|
this.IsVisible = true;
|
||||||
|
this.IsEnabled = true;
|
||||||
|
this.IsExpanded = true;
|
||||||
|
View = new GitHubConnectContent();
|
||||||
|
View.ViewModel = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DoCreate()
|
||||||
|
{
|
||||||
|
// this is done here and not via the constructor so nothing gets loaded
|
||||||
|
// until we get here
|
||||||
|
var ui = ServiceProvider.GetExportedValue<IUIProvider>();
|
||||||
|
|
||||||
|
var factory = ui.GetService<ExportFactoryProvider>();
|
||||||
|
var d = factory.UIControllerFactory.CreateExport();
|
||||||
|
var creation = d.Value.SelectFlow(GitHub.UI.UIControllerFlow.Create);
|
||||||
|
var x = new WindowController(creation);
|
||||||
|
creation.Subscribe(_ => { }, _ => x.Close());
|
||||||
|
x.Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DoClone()
|
||||||
|
{
|
||||||
|
// this is done here and not via the constructor so nothing gets loaded
|
||||||
|
// until we get here
|
||||||
|
var ui = ServiceProvider.GetExportedValue<IUIProvider>();
|
||||||
|
|
||||||
|
var factory = ui.GetService<ExportFactoryProvider>();
|
||||||
|
var d = factory.UIControllerFactory.CreateExport();
|
||||||
|
var creation = d.Value.SelectFlow(GitHub.UI.UIControllerFlow.Clone);
|
||||||
|
creation.Subscribe(_ => { }, _ => d.Dispose());
|
||||||
|
var x = new WindowController(creation);
|
||||||
|
x.Show();
|
||||||
|
|
||||||
|
d.Value.Start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
<UserControl x:Class="GitHub.VisualStudio.UI.Views.GitHubConnectContent"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
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:ui="clr-namespace:GitHub.UI;assembly=GitHub.UI"
|
||||||
|
xmlns:helpers="clr-namespace:GitHub.Helpers;assembly=GitHub.UI"
|
||||||
|
xmlns:vsshell="clr-namespace:Microsoft.VisualStudio.Shell;assembly=Microsoft.VisualStudio.Shell.12.0"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="300" d:DesignWidth="300" d:DesignBackground="White">
|
||||||
|
<UserControl.Resources>
|
||||||
|
<ResourceDictionary>
|
||||||
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
<ResourceDictionary Source="pack://application:,,,/GitHub.UI;component/Assets/Styles.xaml" />
|
||||||
|
<ResourceDictionary Source="pack://application:,,,/GitHub.UI;component/Assets/Controls.xaml" />
|
||||||
|
<ResourceDictionary Source="pack://application:,,,/GitHub.UI;component/Assets/TextBlocks.xaml" />
|
||||||
|
<ResourceDictionary Source="pack://application:,,,/GitHub.UI.Reactive;component/Assets/Controls.xaml" />
|
||||||
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
<Style TargetType="Label">
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource {x:Static vsshell:VsBrushes.ToolWindowTextKey}}" />
|
||||||
|
<Setter Property="Padding" Value="0" />
|
||||||
|
</Style>
|
||||||
|
</ResourceDictionary>
|
||||||
|
</UserControl.Resources>
|
||||||
|
<Grid>
|
||||||
|
<WrapPanel Orientation="Horizontal" Grid.Row="0" Margin="0,0,0,6">
|
||||||
|
<TextBlock><Hyperlink x:Name="cloneLink" Click="cloneLink_Click">Clone</Hyperlink></TextBlock>
|
||||||
|
<Label Margin="6 0 6 0">|</Label>
|
||||||
|
<TextBlock><Hyperlink x:Name="createLink" Click="createLink_Click">Create</Hyperlink></TextBlock>
|
||||||
|
</WrapPanel>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
|
@ -0,0 +1,57 @@
|
||||||
|
using GitHub.VisualStudio.TeamExplorerConnect;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace GitHub.VisualStudio.UI.Views
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This is a temporary placeholder class until the VS Connect section
|
||||||
|
/// is done
|
||||||
|
/// </summary>
|
||||||
|
public partial class GitHubConnectContent : UserControl
|
||||||
|
{
|
||||||
|
public GitHubConnectContent()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void cloneLink_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
ViewModel.DoClone();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createLink_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
ViewModel.DoCreate();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void m_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public PlaceholderGitHubSection ViewModel
|
||||||
|
{
|
||||||
|
get { return (PlaceholderGitHubSection)GetValue(ViewModelProperty); }
|
||||||
|
set { SetValue(ViewModelProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public static readonly DependencyProperty ViewModelProperty =
|
||||||
|
DependencyProperty.Register(
|
||||||
|
"ViewModel",
|
||||||
|
typeof(PlaceholderGitHubSection),
|
||||||
|
typeof(GitHubConnectContent));
|
||||||
|
}
|
||||||
|
}
|
Загрузка…
Ссылка в новой задаче