Skip to content

Commit

Permalink
Included error messages to projectgrid
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanKert committed Mar 29, 2019
1 parent 0485750 commit 28b7bd3
Show file tree
Hide file tree
Showing 24 changed files with 463 additions and 547 deletions.
29 changes: 0 additions & 29 deletions src/BuildVision.Contracts/Models/BuildedProject.cs

This file was deleted.

2 changes: 1 addition & 1 deletion src/BuildVision.Contracts/Models/ErrorItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public ErrorItem(ErrorLevel errorLevel)

public ErrorItem() { }


public void Init(BuildErrorEventArgs e)
{
Code = e.Code;
Expand Down Expand Up @@ -94,6 +93,7 @@ public void Init(BuildMessageEventArgs e)
Subcategory = e.Subcategory;
Message = e.Message;
}

// 1. EnvDTE.TextSelection.MoveToLineAndOffset requires line and offset numbers beginning at one.
// BuildErrorEventArgs.LineNumber and BuildErrorEventArgs.ColumnNumber may be uninitialized.
// 2. BuildErrorEventArgs.EndLineNumber and BuildErrorEventArgs.EndColumnNumber may be uninitialized,
Expand Down
80 changes: 0 additions & 80 deletions src/BuildVision.Contracts/Models/ErrorsBox.cs

This file was deleted.

11 changes: 7 additions & 4 deletions src/BuildVision.Contracts/Models/IProjectItem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.ObjectModel;
using System.Windows.Controls;
using BuildVision.Contracts;

Expand All @@ -12,8 +13,6 @@ public interface IProjectItem
DateTime? BuildStartTime { get; set; }
string CommonType { get; set; }
string Configuration { get; set; }
ErrorsBox ErrorsBox { get; set; }
int ErrorsCount { get; }
string ExtenderNames { get; set; }
string FlavourType { get; set; }
string Framework { get; set; }
Expand All @@ -22,7 +21,6 @@ public interface IProjectItem
bool IsBatchBuildProject { get; set; }
string Language { get; set; }
string MainFlavourType { get; set; }
int MessagesCount { get; }
string Name { get; set; }
string OutputType { get; set; }
string Platform { get; set; }
Expand All @@ -32,7 +30,12 @@ public interface IProjectItem
ControlTemplate StateBitmap { get; }
bool Success { get; set; }
string UniqueName { get; set; }
int WarningsCount { get; }
int MessagesCount { get; set; }
int ErrorsCount { get; set; }
int WarningsCount { get; set; }
ObservableCollection<ErrorItem> Errors { get; set; }
ObservableCollection<ErrorItem> Warnings { get; set; }
ObservableCollection<ErrorItem> Messages { get; set; }

void RaiseBuildElapsedTimeChanged();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using BuildVision.Contracts;

namespace BuildVision.Services
namespace BuildVision.Exports.Services
{
public interface IErrorNavigationService
{
Expand Down
2 changes: 2 additions & 0 deletions src/BuildVision.UI/BuildVision.UI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@
<Compile Include="Controls\Indicators\WarningProjectsIndicator.cs" />
<Compile Include="Controls\Indicators\WarningsIndicator.cs" />
<Compile Include="Converters\BooleanToHiddenConverter.cs" />
<Compile Include="Converters\InProgressToCollapsedConverter.cs" />
<Compile Include="Converters\InProgressToVisibleConverter.cs" />
<Compile Include="Converters\StateIconKeyToIconConverter.cs" />
<Compile Include="Enums\ResetTaskBarItemInfoCondition.cs" />
<Compile Include="Helpers\SortDescription.cs" />
Expand Down
73 changes: 24 additions & 49 deletions src/BuildVision.UI/Components/ControlView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
<converters:StateIconKeyToIconConverter x:Key="StateIconKeyToIconConverter" />
<converters:BooleanToHiddenConverter x:Key="BooleanToHiddenConverter" />

<converters:InProgressToCollapsedConverter x:Key="InProgressToCollapsedConverter" />
<converters:InProgressToVisibleConverter x:Key="InProgressToVisibleConverter" />


</ResourceDictionary>
</UserControl.Resources>

Expand All @@ -53,39 +57,21 @@

<Grid Background="{DynamicResource ToolWindowBackgroundKey}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="50" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>


<Grid Grid.Column="0"
Margin="0,-7,8,0">
<ContentControl Width="32"
Height="32"
VerticalAlignment="Top"
ClipToBounds="True"
SnapsToDevicePixels="True"
UseLayoutRounding="False"
Visibility="{Binding BuildInformationModel.IsFinished, Converter={StaticResource BooleanToHiddenConverter}}"
Template="{Binding BuildInformationModel.StateIconKey, Converter={StaticResource StateIconKeyToIconConverter}}" />
<ContentControl Width="32"
Height="32"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Panel.ZIndex="1"
ClipToBounds="False"
SnapsToDevicePixels="True"
UseLayoutRounding="False"
Visibility="{Binding BuildInformationModel.IsFinished, Converter={StaticResource VisibilityToBoolConverter}}"
Template="{Binding BuildInformationModel.StateIconKey, Converter={StaticResource StateIconKeyToIconConverter}}" />
</Grid>

<TextBlock Grid.Column="1"
FontSize="18"
Foreground="{DynamicResource ToolWindowTextKey}"
Text="{Binding BuildInformationModel.StateMessage}"
TextTrimming="WordEllipsis"
extensions:TextBlockUtils.AutoTooltip="True" />
<ContentControl Template="{Binding BuildInformationModel.StateIconKey, Converter={StaticResource StateIconKeyToIconConverter}}" />

<TextBlock
Margin="2,0"
Grid.Column="1"
FontSize="18"
Foreground="{DynamicResource ToolWindowTextKey}"
Text="{Binding BuildInformationModel.StateMessage}"
TextTrimming="WordEllipsis"
extensions:TextBlockUtils.AutoTooltip="True"
VerticalAlignment="Center" />
</Grid>

<controls:BuildVisionProgressBar DataContext="{Binding BuildInformationModel.CurrentBuildState}" />
Expand All @@ -107,40 +93,31 @@
Orientation="Horizontal">

<StackPanel Orientation="Horizontal"
IsEnabled="true">
<StackPanel.Style>
<Style TargetType="{x:Type StackPanel}">
<Setter Property="Visibility" Value="Visible" />
<Style.Triggers>
<DataTrigger Binding="{Binding BuildInformationModel.CurrentBuildState}" Value="{x:Static contracts:BuildState.InProgress}">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
</Style.Triggers>
</Style>
</StackPanel.Style>
IsEnabled="true"
Visibility="{Binding BuildInformationModel.CurrentBuildState, Converter={StaticResource InProgressToCollapsedConverter}}">

<customButtons:BuildActionButton Command="{Binding BuildSolutionAction}" ToolTip="{x:Static res:Resources.BuildSolutionButtonTooltip}">
<ContentControl Template="{StaticResource BuildSolutionIcon}" />
</customButtons:BuildActionButton>

<customButtons:BuildActionButton Command="{Binding BuildSolutionAction}" ToolTip="{x:Static res:Resources.RebuildSolutionButtonTooltip}">
<customButtons:BuildActionButton Command="{Binding RebuildSolutionAction}" ToolTip="{x:Static res:Resources.RebuildSolutionButtonTooltip}">
<ContentControl Template="{StaticResource RebuildSolutionIcon}" />
</customButtons:BuildActionButton>

<customButtons:BuildActionButton Command="{Binding BuildSolutionAction}" ToolTip="{x:Static res:Resources.CleanSolutionButtonTooltip}">
<customButtons:BuildActionButton Command="{Binding CleanSolutionAction}" ToolTip="{x:Static res:Resources.CleanSolutionButtonTooltip}">
<ContentControl Template="{StaticResource CleanSolutionIcon}" />
</customButtons:BuildActionButton>

</StackPanel>


<customButtons:BuildActionButton
Command="{Binding BuildSolutionAction}"
HorizontalAlignment="Stretch"
MinWidth="66"
ToolTip="{x:Static res:Resources.CancelBuildSolutionButtonTooltip}"
IsEnabled="False"
Visibility="Collapsed">
Visibility="{Binding BuildInformationModel.CurrentBuildState, Converter={StaticResource InProgressToVisibleConverter}}">

<customButtons:BuildActionButton.Content>
<StackPanel Orientation="Horizontal">
<ContentControl Template="{StaticResource CancelBuildSolutionIcon}" />
Expand All @@ -152,10 +129,8 @@
<Style TargetType="{x:Type customButtons:BuildActionButton}">
<Style.Triggers>
<DataTrigger Binding="{Binding BuildInformationModel.CurrentBuildState}" Value="{x:Static contracts:BuildState.InProgress}">
<Setter Property="Visibility" Value="Visible" />
</DataTrigger>
<DataTrigger Binding="{Binding BuildInformationModel.CurrentBuildState}" Value="{x:Static contracts:BuildState.InProgress}">
<Setter Property="IsEnabled" Value="True" />
<Setter Property="customButtons:BuildActionButton.Visibility" Value="Visible" />
<Setter Property="customButtons:BuildActionButton.IsEnabled" Value="True" />
</DataTrigger>
</Style.Triggers>
</Style>
Expand Down
22 changes: 15 additions & 7 deletions src/BuildVision.UI/Components/ErrorsGrid.xaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
<UserControl x:Class="BuildVision.UI.ErrorsGrid"
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:contracts="clr-namespace:BuildVision.Contracts;assembly=BuildVision.Contracts"
xmlns:componentModel="clr-namespace:System.ComponentModel;assembly=WindowsBase"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:extensions="clr-namespace:BuildVision.UI.Extensions"
mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300" Loaded="ErrorsGridLoaded"
Name="Control">
xmlns:contracts="clr-namespace:BuildVision.Contracts;assembly=BuildVision.Contracts"
xmlns:componentModel="clr-namespace:System.ComponentModel;assembly=WindowsBase"
xmlns:models="clr-namespace:BuildVision.UI.Models"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="300"
Loaded="ErrorsGridLoaded"
Name="Control"
d:DataContext="{Binding Source={StaticResource DesignViewModel}}">

<UserControl.Resources>
<ResourceDictionary>
Expand All @@ -16,13 +21,16 @@
<ResourceDictionary Source="../Styles/ScrollViewerStyle.xaml" />
</ResourceDictionary.MergedDictionaries>

<CollectionViewSource x:Key="ErrorsCollectionViewSource" Source="{Binding ErrorsBox}">
<CollectionViewSource x:Key="ErrorsCollectionViewSource" Source="{Binding Errors}">
<CollectionViewSource.SortDescriptions>
<componentModel:SortDescription PropertyName="{x:Static contracts:ErrorItem.DefaultSortPropertyName}" Direction="Ascending" />
</CollectionViewSource.SortDescriptions>
</CollectionViewSource>

<models:ProjectItem x:Key="DesignViewModel"/>
</ResourceDictionary>
</UserControl.Resources>

<Grid DataContext="{Binding ProjectItem}">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<DataGrid
Expand Down
14 changes: 10 additions & 4 deletions src/BuildVision.UI/Components/ErrorsGrid.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,36 @@ namespace BuildVision.UI
/// </summary>
public partial class ErrorsGrid : UserControl
{
public static readonly DependencyProperty ProjectItemProperty = DependencyProperty.Register(nameof(ProjectItem), typeof(ProjectItem), typeof(ErrorsGrid));
public static DependencyProperty NavigateToErrorCommandProperty = DependencyProperty.Register(nameof(NavigateToErrorCommand), typeof(ICommand), typeof(ErrorsGrid));

private ScrollViewer _errorsGridScrollViewer;

public ErrorsGrid()
{
InitializeComponent();
}

public static readonly DependencyProperty ProjectItemProperty = DependencyProperty.Register(nameof(ProjectItem), typeof(ProjectItem), typeof(ErrorsGrid));

public ProjectItem ProjectItem
{
get => (ProjectItem)GetValue(ProjectItemProperty);
set => SetValue(ProjectItemProperty, value);
}

public ICommand NavigateToErrorCommand
{
get => (ICommand)GetValue(NavigateToErrorCommandProperty);
set => SetValue(NavigateToErrorCommandProperty, value);
}

private void ErrorsGridRowOnMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
try
{
var row = (DataGridRow)sender;
var errorItem = (ErrorItem)row.Item;
// TODO navigate to error
//errorItem.GoToError();
NavigateToErrorCommand.Execute(errorItem);
e.Handled = true;
}
catch (Exception ex)
Expand All @@ -63,7 +70,6 @@ private void ErrorsGridOnPreviewMouseWheel(object sender, MouseWheelEventArgs e)
parent.RaiseEvent(eventArg);
}


private void ErrorsGridLoaded(object sender, RoutedEventArgs e)
{
_errorsGridScrollViewer = VisualHelper.FindVisualChild<ScrollViewer>(this);
Expand Down
Loading

0 comments on commit 28b7bd3

Please sign in to comment.