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

Refactor: Move views to GitHub.VisualStudio.UI #1955

Merged
merged 6 commits into from
Oct 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
using System;
using System.Collections.ObjectModel;
using System.Collections.ObjectModel;
using System.Diagnostics.CodeAnalysis;
using System.Reactive;
using GitHub.InlineReviews.ViewModels;
using GitHub.Models;
using GitHub.ViewModels;
using ReactiveUI;

namespace GitHub.InlineReviews.SampleData
namespace GitHub.SampleData
{
[SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")]
class CommentThreadViewModelDesigner : ICommentThreadViewModel
public class CommentThreadViewModelDesigner : ICommentThreadViewModel
{
public ObservableCollection<ICommentViewModel> Comments { get; }
= new ObservableCollection<ICommentViewModel>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
using System;
using System.Reactive;
using System.Diagnostics.CodeAnalysis;
using GitHub.InlineReviews.ViewModels;
using ReactiveUI;
using System.Reactive;
using GitHub.ViewModels;
using ReactiveUI;

namespace GitHub.InlineReviews.SampleData
namespace GitHub.SampleData
{
[SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")]
class CommentViewModelDesigner : ReactiveObject, ICommentViewModel
public class CommentViewModelDesigner : ReactiveObject, ICommentViewModel
{
public CommentViewModelDesigner()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Globalization;
using System.Windows.Forms;

namespace GitHub.InlineReviews.Services
namespace GitHub.Services
{
[Export(typeof(ICommentService))]
[PartCreationPolicy(CreationPolicy.NonShared)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
using System.Reactive;
using System.Reactive.Linq;
using System.Threading.Tasks;
using System.Windows;
using GitHub.Extensions;
using GitHub.InlineReviews.Services;
using GitHub.Logging;
using GitHub.Models;
using GitHub.Services;
using GitHub.ViewModels;
using ReactiveUI;
using Serilog;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace GitHub.InlineReviews.Services
namespace GitHub.Services
{
/// <summary>
/// This service allows for functionality to be injected into the chain of different peek Comment ViewModel types.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
using System;
using System.Collections.ObjectModel;
using System.Collections.ObjectModel;
using System.Reactive;
using GitHub.Models;
using GitHub.ViewModels;
using ReactiveUI;

namespace GitHub.InlineReviews.ViewModels
namespace GitHub.ViewModels
{
/// <summary>
/// A comment thread.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using System;
using System.Reactive;
using GitHub.Models;
using GitHub.ViewModels;
using ReactiveUI;

namespace GitHub.InlineReviews.ViewModels
namespace GitHub.ViewModels
{
public enum CommentEditState
{
Expand Down
26 changes: 3 additions & 23 deletions src/GitHub.InlineReviews/GitHub.InlineReviews.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@
<Compile Include="Margins\InlineCommentMargin.cs" />
<Compile Include="Margins\InlineCommentMarginVisible.cs" />
<Compile Include="Margins\InlineCommentMarginEnabled.cs" />
<Compile Include="Services\CommentService.cs" />
<Compile Include="Services\ICommentService.cs" />
<Compile Include="PullRequestStatusBarPackage.cs" />
<Compile Include="InlineReviewsPackage.cs" />
<Compile Include="Models\InlineCommentThreadModel.cs" />
Expand All @@ -102,7 +100,6 @@
<Compile Include="Peek\InlineCommentPeekResultPresentation.cs" />
<Compile Include="Peek\InlineCommentPeekResultPresenter.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SampleData\CommentThreadViewModelDesigner.cs" />
<Compile Include="Services\IInlineCommentPeekService.cs" />
<Compile Include="Services\IPullRequestSessionService.cs" />
<Compile Include="Services\InlineCommentPeekService.cs" />
Expand All @@ -111,9 +108,6 @@
<Compile Include="Margins\InlineCommentMarginProvider.cs" />
<Compile Include="Services\PullRequestSessionService.cs" />
<Compile Include="ViewModels\PullRequestFileMarginViewModel.cs" />
<Compile Include="ViewModels\CommentViewModel.cs" />
<Compile Include="ViewModels\ICommentThreadViewModel.cs" />
<Compile Include="ViewModels\CommentThreadViewModel.cs" />
<Compile Include="ViewModels\InlineCommentPeekViewModel.cs" />
<Compile Include="ViewModels\IPullRequestReviewCommentViewModel.cs" />
<Compile Include="ViewModels\NewInlineCommentThreadViewModel.cs" />
Expand All @@ -128,7 +122,6 @@
<Compile Include="Views\InlineCommentPeekView.xaml.cs">
<DependentUpon>InlineCommentPeekView.xaml</DependentUpon>
</Compile>
<Compile Include="SampleData\CommentViewModelDesigner.cs" />
<Compile Include="Services\DiffService.cs" />
<Compile Include="Services\IDiffService.cs" />
<Compile Include="Tags\AddInlineCommentTag.cs" />
Expand All @@ -144,13 +137,6 @@
<Compile Include="Tags\InlineCommentTagger.cs" />
<Compile Include="Tags\InlineCommentTaggerProvider.cs" />
<Compile Include="ViewModels\InlineCommentThreadViewModel.cs" />
<Compile Include="ViewModels\ICommentViewModel.cs" />
<Compile Include="Views\CommentThreadView.xaml.cs">
<DependentUpon>CommentThreadView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\CommentView.xaml.cs">
<DependentUpon>CommentView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\PullRequestStatusView.xaml.cs">
<DependentUpon>PullRequestStatusView.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -460,14 +446,6 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\CommentThreadView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\CommentView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\PullRequestStatusView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand All @@ -481,7 +459,9 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Folder Include="SampleData\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != '' And '$(NCrunch)' != '1'" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Reactive;
using GitHub.ViewModels;
using ReactiveUI;

namespace GitHub.InlineReviews.ViewModels
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using GitHub.Models;
using GitHub.Primitives;
using GitHub.Services;
using GitHub.ViewModels;
using Microsoft.VisualStudio.Language.Intellisense;
using Microsoft.VisualStudio.Text;
using ReactiveUI;
Expand Down
40 changes: 0 additions & 40 deletions src/GitHub.InlineReviews/Views/CommentThreadView.xaml

This file was deleted.

2 changes: 1 addition & 1 deletion src/GitHub.InlineReviews/Views/InlineCommentPeekView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
VerticalScrollBarVisibility="Auto"
Background="{DynamicResource GitHubPeekViewBackground}">
<Grid>
<local:CommentThreadView x:Name="threadView" DataContext="{Binding Thread}"/>
<ghfvs:CommentThreadView x:Name="threadView" DataContext="{Binding Thread}"/>
</Grid>
</ScrollViewer>
</DockPanel>
Expand Down
10 changes: 8 additions & 2 deletions src/GitHub.VisualStudio.UI/GitHub.VisualStudio.UI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<Import Project="$(SolutionDir)\src\common\signing.props" />

<ItemGroup>
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Xaml" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
Expand All @@ -15,12 +16,17 @@

<ItemGroup>
<ProjectReference Include="..\..\submodules\reactiveui\ReactiveUI.Events\ReactiveUI.Events_Net45.csproj" />
<ProjectReference Include="..\GitHub.Exports.Reactive\GitHub.Exports.Reactive.csproj" />
<ProjectReference Include="..\GitHub.UI\GitHub.UI.csproj" />
<ProjectReference Include="..\GitHub.App\GitHub.App.csproj" />
<ProjectReference Include="..\GitHub.UI.Reactive\GitHub.UI.Reactive.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="EnvDTE" Version="8.0.1" />
<PackageReference Include="Markdig.Signed" version="0.13.0" />
<PackageReference Include="Markdig.Wpf.Signed" version="0.2.1" />
<PackageReference Include="Microsoft.VisualStudio.SDK.EmbedInteropTypes" Version="15.0.17" />
<PackageReference Include="Microsoft.VisualStudio.ImageCatalog" version="14.3.25407" />
<PackageReference Include="Microsoft.VisualStudio.Shell.Interop.14.0.DesignTime" version="14.3.25407" />
<PackageReference Include="Rx-XAML" version="2.2.5-custom" />
</ItemGroup>
</Project>
3 changes: 3 additions & 0 deletions src/GitHub.VisualStudio.UI/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
[assembly: XmlnsDefinition("https://github.com/github/VisualStudio", "GitHub.VisualStudio.UI")]
[assembly: XmlnsDefinition("https://github.com/github/VisualStudio", "GitHub.VisualStudio.UI.Controls")]
[assembly: XmlnsDefinition("https://github.com/github/VisualStudio", "GitHub.VisualStudio.UI.Views")]
[assembly: XmlnsDefinition("https://github.com/github/VisualStudio", "GitHub.VisualStudio.Views")]
[assembly: XmlnsDefinition("https://github.com/github/VisualStudio", "GitHub.VisualStudio.Views.Dialog")]
[assembly: XmlnsDefinition("https://github.com/github/VisualStudio", "GitHub.VisualStudio.Views.GitHubPane")]
40 changes: 40 additions & 0 deletions src/GitHub.VisualStudio.UI/Views/CommentThreadView.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<UserControl x:Class="GitHub.VisualStudio.Views.CommentThreadView"
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.Views"
xmlns:ghfvs="https://github.com/github/VisualStudio"
mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300">
<d:DesignProperties.DataContext>
<x:Array Type="{x:Type ghfvs:CommentThreadViewModelDesigner}">
<ghfvs:CommentThreadViewModelDesigner>
<!-- <ghfvs:CommentThreadViewModelDesigner.Comments>
<ghfvs:CommentViewModelDesigner>
<ghfvs:CommentViewModelDesigner.Body>
I assume this doesn't do anything if our message isn't showing?
</ghfvs:CommentViewModelDesigner.Body>
</ghfvs:CommentViewModelDesigner>
<ghfvs:CommentViewModelDesigner>
<ghfvs:CommentViewModelDesigner.Body>
Nope, does nothing! Also checked the logs.
</ghfvs:CommentViewModelDesigner.Body>
</ghfvs:CommentViewModelDesigner>
<ghfvs:CommentViewModelDesigner EditState="Placeholder">
<ghfvs:CommentViewModelDesigner.Body>
Reply...
</ghfvs:CommentViewModelDesigner.Body>
</ghfvs:CommentViewModelDesigner>
</ghfvs:CommentThreadViewModelDesigner.Comments> -->
</ghfvs:CommentThreadViewModelDesigner>
</x:Array>
</d:DesignProperties.DataContext>

<ItemsControl ItemsSource="{Binding Comments}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<local:CommentView Margin="0 4"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</UserControl>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Windows.Controls;
using GitHub.VisualStudio.UI.Helpers;

namespace GitHub.InlineReviews.Views
namespace GitHub.VisualStudio.Views
{
public partial class CommentThreadView : UserControl
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
<views:GenericCommentView x:Class="GitHub.InlineReviews.Views.CommentView"
<views:GenericCommentView x:Class="GitHub.VisualStudio.Views.CommentView"
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:ghfvs="https://github.com/github/VisualStudio"
xmlns:cache="clr-namespace:GitHub.UI.Helpers;assembly=GitHub.UI"
xmlns:controls="clr-namespace:GitHub.VisualStudio.UI.Controls;assembly=GitHub.VisualStudio.UI"
xmlns:controls="clr-namespace:GitHub.VisualStudio.UI.Controls"
xmlns:ui="clr-namespace:GitHub.UI;assembly=GitHub.UI"
xmlns:markdig="clr-namespace:Markdig.Wpf;assembly=Markdig.Wpf"
xmlns:sample="clr-namespace:GitHub.InlineReviews.SampleData"
xmlns:views="clr-namespace:GitHub.InlineReviews.Views"
xmlns:views="clr-namespace:GitHub.VisualStudio.Views"
mc:Ignorable="d" d:DesignWidth="300">
<d:DesignProperties.DataContext>
<sample:CommentViewModelDesigner EditState="None">
<sample:CommentViewModelDesigner.Body>
<ghfvs:CommentViewModelDesigner EditState="None">
<ghfvs:CommentViewModelDesigner.Body>
You can use a `CompositeDisposable` type here, it's designed to handle disposables in an optimal way (you can just call `Dispose()` on it and it will handle disposing everything it holds).
</sample:CommentViewModelDesigner.Body>
</sample:CommentViewModelDesigner>
</ghfvs:CommentViewModelDesigner.Body>
</ghfvs:CommentViewModelDesigner>
</d:DesignProperties.DataContext>

<FrameworkElement.Resources>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
using GitHub.InlineReviews.ViewModels;
using GitHub.Services;
using GitHub.UI;
using GitHub.ViewModels;
using Microsoft.VisualStudio.Shell;
using ReactiveUI;

namespace GitHub.InlineReviews.Views
namespace GitHub.VisualStudio.Views
{
public class GenericCommentView : ViewBase<ICommentViewModel, GenericCommentView> { }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
xmlns:ghfvs="https://github.com/github/VisualStudio"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:GitHub.VisualStudio.Views.Dialog.Clone"
xmlns:uic="clr-namespace:GitHub.VisualStudio.UI.Controls"
mc:Ignorable="d" d:DesignHeight="414" d:DesignWidth="440">
<d:DesignData.DataContext>
<ghfvs:RepositoryCloneViewModelDesigner/>
Expand Down Expand Up @@ -53,9 +54,9 @@
<TextBox Text="{Binding Path, UpdateSourceTrigger=PropertyChanged}"/>
</DockPanel>

<ghfvs:InfoPanel Message="{Binding PathWarning}"
DockPanel.Dock="Bottom"
Margin="0"/>
<uic:InfoPanel Message="{Binding PathWarning}"
DockPanel.Dock="Bottom"
Margin="0"/>

<TabControl SelectedIndex="{Binding SelectedTabIndex}"
Style="{StaticResource LightModalViewTabControl}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
xmlns:ghfvs="https://github.com/github/VisualStudio"
xmlns:views="clr-namespace:GitHub.VisualStudio.Views"
xmlns:local="clr-namespace:GitHub.VisualStudio.Views.GitHubPane"
xmlns:uic="clr-namespace:GitHub.VisualStudio.UI.Controls"
Foreground="{DynamicResource GitHubVsWindowText}"
d:DesignHeight="300"
d:DesignWidth="300"
Expand Down Expand Up @@ -39,7 +40,7 @@
</Control.Resources>

<DockPanel>
<ghfvs:InfoPanel Name="infoPanel"
<uic:InfoPanel x:Name="infoPanel"
DockPanel.Dock="Top"
Message="{Binding Message}"
VerticalAlignment="Top"/>
Expand Down
Loading