Skip to content

Commit

Permalink
Fixed issue with indicators
Browse files Browse the repository at this point in the history
Added additional unittests
Some cleanup of usings and classes
  • Loading branch information
StefanKert committed Mar 23, 2019
1 parent 2dc9a63 commit 16f40a5
Show file tree
Hide file tree
Showing 31 changed files with 321 additions and 220 deletions.
3 changes: 2 additions & 1 deletion src/BuildVision.Contracts/Models/IBuildInformationModel.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using System;
using System.ComponentModel;

namespace BuildVision.Contracts.Models
{
public interface IBuildInformationModel
public interface IBuildInformationModel : INotifyPropertyChanged
{
BuildActions BuildAction { get; set; }
DateTime? BuildFinishTime { get; set; }
Expand Down
26 changes: 17 additions & 9 deletions src/BuildVision.UI/Components/ControlView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,14 @@
</Style>
</ListBox.Resources>

<indicators:ErrorsIndicator Value="{Binding ErrorCount}" />
<indicators:ErrorsIndicator Value="{Binding BuildInformationModel.ErrorCount, UpdateSourceTrigger=PropertyChanged}" />
<Label Margin="-6,0,0,0" Content="{Binding BuildInformationModel.ErrorCount, UpdateSourceTrigger=PropertyChanged}" Foreground="{DynamicResource ToolWindowTextKey}" Opacity="0.4" />

<indicators:WarningsIndicator Value="{Binding WarningsCount}" />
<indicators:WarningsIndicator Value="{Binding BuildInformationModel.WarningsCount, UpdateSourceTrigger=PropertyChanged}" />
<Label Margin="-6,0,0,0" Content="{Binding BuildInformationModel.WarningsCount, UpdateSourceTrigger=PropertyChanged}" Foreground="{DynamicResource ToolWindowTextKey}" Opacity="0.4" />

<indicators:MessagesIndicator Value="{Binding MessagesCount}" />
<indicators:MessagesIndicator Value="{Binding BuildInformationModel.MessagesCount, UpdateSourceTrigger=PropertyChanged}" />
<Label Margin="-6,0,0,0" Content="{Binding BuildInformationModel.MessagesCount, UpdateSourceTrigger=PropertyChanged}" Foreground="{DynamicResource ToolWindowTextKey}" Opacity="0.4" />
</ListBox>

<Border Grid.Column="3"
Expand Down Expand Up @@ -213,13 +216,18 @@
</Style>
</ListBox.Resources>

<indicators:SuccessProjectsIndicator Value="{Binding SucceededProjectsCount}" />
<indicators:SuccessProjectsIndicator Value="{Binding BuildInformationModel.SucceededProjectsCount, UpdateSourceTrigger=PropertyChanged}" />
<Label Margin="-8,0,0,0" Content="{Binding BuildInformationModel.SucceededProjectsCount}" Foreground="{DynamicResource ToolWindowTextKey}" Opacity="0.4" />

<indicators:UpToDateProjectsIndicator Value="{Binding BuildInformationModel.UpToDateProjectsCount, UpdateSourceTrigger=PropertyChanged}" />
<Label Margin="-6,0,0,0" Content="{Binding BuildInformationModel.UpToDateProjectsCount}" Foreground="{DynamicResource ToolWindowTextKey}" Opacity="0.4" />

<indicators:WarningProjectsIndicator Value="{Binding BuildInformationModel.WarnedProjectsCount, UpdateSourceTrigger=PropertyChanged}" />
<Label Margin="-6,0,0,0" Content="{Binding BuildInformationModel.WarnedProjectsCount}" Foreground="{DynamicResource ToolWindowTextKey}" Opacity="0.4" />

<indicators:ErrorProjectsIndicator Value="{Binding BuildInformationModel.FailedProjectsCount, UpdateSourceTrigger=PropertyChanged}" />
<Label Margin="-6,0,0,0" Content="{Binding BuildInformationModel.FailedProjectsCount}" Foreground="{DynamicResource ToolWindowTextKey}" Opacity="0.4" />

<indicators:UpToDateProjectsIndicator Value="{Binding UpToDateProjectsCount}" />

<indicators:WarningProjectsIndicator Value="{Binding WarnedProjectsCount}" />

<indicators:ErrorProjectsIndicator Value="{Binding FailedProjectsCount}" />
</ListBox>

</Grid>
Expand Down
3 changes: 2 additions & 1 deletion src/BuildVision.UI/Controls/BuildVisionProgressBar.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
xmlns:contracts="clr-namespace:BuildVision.Contracts;assembly=BuildVision.Contracts"
d:DesignWidth="697">
<Grid>
<Line Name="Line"
Expand Down Expand Up @@ -34,7 +35,7 @@
<Line.Style>
<Style>
<Style.Triggers>
<DataTrigger Binding="{Binding ActionProgressIsVisible, FallbackValue=True}" Value="True">
<DataTrigger Binding="{Binding}" Value="{x:Static contracts:BuildState.InProgress}">
<DataTrigger.EnterActions>
<BeginStoryboard x:Name="LineProgressBeginStoryboard">
<Storyboard>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,10 @@ public ErrorProjectsIndicator()
{
Header = UI.Resources.ErrorProjectsIndicator_Header;
}

static void OnValueChange(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
d.SetValue(ValueProperty, (long)e.NewValue);
}
}
}
5 changes: 5 additions & 0 deletions src/BuildVision.UI/Controls/Indicators/ErrorsIndicator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,10 @@ public ErrorsIndicator()
{
Header = UI.Resources.ErrorsIndicator_Header;
}

static void OnValueChange(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
d.SetValue(ValueProperty, (long)e.NewValue);
}
}
}
5 changes: 5 additions & 0 deletions src/BuildVision.UI/Controls/Indicators/MessagesIndicator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,10 @@ public MessagesIndicator()
{
Header = UI.Resources.MessagesIndicator_Header;
}

static void OnValueChange(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
d.SetValue(ValueProperty, (long)e.NewValue);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,10 @@ public SuccessProjectsIndicator()
{
Header = UI.Resources.SuccessProjectsIndicator_Header;
}

static void OnValueChange(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
d.SetValue(ValueProperty, (long)e.NewValue);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,10 @@ public UpToDateProjectsIndicator()
{
Header = UI.Resources.UpToDateProjectsIndicator_Header;
}

static void OnValueChange(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
d.SetValue(ValueProperty, (long)e.NewValue);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,10 @@ public WarningProjectsIndicator()
{
Header = UI.Resources.WarningProjectsIndicator_Header;
}

static void OnValueChange(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
d.SetValue(ValueProperty, (long)e.NewValue);
}
}
}
5 changes: 5 additions & 0 deletions src/BuildVision.UI/Controls/Indicators/WarningsIndicator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,10 @@ public WarningsIndicator()
{
Header = UI.Resources.WarningsIndicator_Header;
}

static void OnValueChange(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
d.SetValue(ValueProperty, (long)e.NewValue);
}
}
}
6 changes: 3 additions & 3 deletions src/BuildVision.UI/Models/BuildInformationModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,21 @@ public int MessagesCount
private int _succeededProjectsCount;
public int SucceededProjectsCount
{
get => _warningsCount;
get => _succeededProjectsCount;
set => SetProperty(ref _succeededProjectsCount, value);
}

private int _upToDateProjectsCount;
public int UpToDateProjectsCount
{
get => _warningsCount;
get => _upToDateProjectsCount;
set => SetProperty(ref _upToDateProjectsCount, value);
}

private int _failedProjectsCount;
public int FailedProjectsCount
{
get => _warningsCount;
get => _failedProjectsCount;
set => SetProperty(ref _failedProjectsCount, value);
}

Expand Down
10 changes: 1 addition & 9 deletions src/BuildVision.UI/Themes/Generic.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,14 @@
<Setter.Value>
<ControlTemplate TargetType="{x:Type indicators:ValueIndicator}">
<StackPanel Orientation="Vertical" ToolTipService.ShowOnDisabled="True" ToolTipService.ToolTip="{TemplateBinding Header}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ContentControl
<ContentControl
Grid.Column="0"
Width="16"
Height="16"
SnapsToDevicePixels="True"
ClipToBounds="True"
UseLayoutRounding="False"
Template="{TemplateBinding Icon}" />
<Label Grid.Column="1" Content="{TemplateBinding Value}" Foreground="{DynamicResource ToolWindowTextKey}" Opacity="0.4"/>

</Grid>
</StackPanel>
</ControlTemplate>
</Setter.Value>
Expand Down
12 changes: 6 additions & 6 deletions src/BuildVision/BuildVision.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
<Reference Include="System.Xaml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Constants\EnvDTECodeModelLanguageConstants2.cs" />
<Compile Include="Services\BuildInformationProvider.cs" />
<Compile Include="Services\BuildingProjectsProvider.cs" />
<Compile Include="Services\ProjectFileNavigationService.cs" />
Expand All @@ -103,11 +104,10 @@
<Compile Include="Services\StatusBarNotificationService.cs" />
<Compile Include="Helpers\BuildEventContextExtensions.cs" />
<Compile Include="Helpers\BuildMessageEventArgsExtensions.cs" />
<Compile Include="Helpers\EnvDTEProjectKinds.cs" />
<Compile Include="Helpers\ProjectItemExtensions.cs" />
<Compile Include="Constants\EnvDTEProjectKinds.cs" />
<Compile Include="Helpers\SolutionProjectsExtensions.cs" />
<Compile Include="Helpers\ProjectExtensions.cs" />
<Compile Include="Helpers\ProjectItemsExtensions.cs" />
<Compile Include="Helpers\ProjectItemExtensions.cs" />
<Compile Include="Helpers\PropertiesExtensions.cs" />
<Compile Include="Helpers\StateConverterHelper.cs" />
<Compile Include="Helpers\UIHierarchyExtensions.cs" />
Expand All @@ -117,6 +117,7 @@
<Compile Include="Tool\Building\BuildManager.cs" />
<Compile Include="Tool\Building\BuildOutputLogger.cs" />
<Compile Include="Core\IPackageContext.cs" />
<Compile Include="Tool\Building\WindowStateManager.cs" />
<Compile Include="Tool\Views\Settings\BuildMessagesSettingsDialogPage.cs">
<SubType>Component</SubType>
</Compile>
Expand All @@ -137,10 +138,9 @@
<SubType>Component</SubType>
</Compile>
<Compile Include="Core\BuildVisionPane.cs" />
<Compile Include="Core\PackageGuids.cs" />
<Compile Include="Constants\PackageGuids.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Core\PackageIds.cs" />
<Compile Include="Helpers\ToolWindowManager.cs" />
<Compile Include="Constants\PackageIds.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="VSPackage.resx">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace BuildVision.Helpers
{
public class EnvDTECodeModelLanguageConstants2
{
public const string CMLanguageJSharp = "{E6FDF8BF-F3D1-11D4-8576-0002A516ECE8}";
}
}
File renamed without changes.
File renamed without changes.
25 changes: 0 additions & 25 deletions src/BuildVision/Core/BuildVisionPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,17 @@
using System.Runtime.InteropServices;
using System.Threading;
using System.Windows;
using BuildVision.Common;
using BuildVision.Contracts;
using BuildVision.Exports.Providers;
using BuildVision.Helpers;
using BuildVision.Tool;
using BuildVision.Tool.Building;
using BuildVision.Tool.Models;
using BuildVision.UI;
using BuildVision.UI.Common.Logging;
using BuildVision.UI.Extensions;
using BuildVision.UI.Helpers;
using BuildVision.UI.Settings.Models;
using BuildVision.UI.ViewModels;
using BuildVision.Views.Settings;
using EnvDTE;
using EnvDTE80;
using Microsoft.VisualStudio;
using Microsoft.VisualStudio.Settings;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using Microsoft.VisualStudio.Shell.Settings;
using VSLangProj;
using Task = System.Threading.Tasks.Task;

namespace BuildVision.Core
Expand Down Expand Up @@ -148,7 +137,6 @@ private async void ShowToolWindowAsync(object sender, EventArgs e)
}
}


ToolWindowPane ShowToolWindow(Guid windowGuid)
{
ThreadHelper.ThrowIfNotOnUIThread();
Expand Down Expand Up @@ -184,18 +172,5 @@ public async Task ExecuteCommandAsync(string commandName)
await JoinableTaskFactory.SwitchToMainThreadAsync(DisposalToken);
_dte.ExecuteCommand(commandName);
}


async Task EnsurePackageLoaded(Guid packageGuid)
{
await JoinableTaskFactory.SwitchToMainThreadAsync(DisposalToken);

var shell = await GetServiceAsync(typeof(SVsShell)) as IVsShell;
if (shell != null)
{
IVsPackage vsPackage;
ErrorHandler.ThrowOnFailure(shell.LoadPackage(ref packageGuid, out vsPackage));
}
}
}
}
23 changes: 7 additions & 16 deletions src/BuildVision/Helpers/ProjectExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,28 +1,19 @@
using System;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

using EnvDTE;
using EnvDTE80;

using Microsoft.Win32;
using VSLangProj;
using System.Globalization;
using Microsoft.VisualStudio.Shell.Interop;
using System.IO;
using System.Linq;
using System.Text;
using BuildVision.Contracts;
using BuildVision.UI;
using BuildVision.UI.Common.Logging;
using BuildVision.Contracts;
using EnvDTE;
using Microsoft.VisualStudio.Shell.Interop;
using Microsoft.Win32;
using VSLangProj;

namespace BuildVision.Helpers
{
public class EnvDTECodeModelLanguageConstants2
{
public const string CMLanguageJSharp = "{E6FDF8BF-F3D1-11D4-8576-0002A516ECE8}";
}

public static class ProjectExtensions
{
private static readonly HashSet<string> _hiddenProjectsUniqueNames = new HashSet<string>
Expand Down
Loading

0 comments on commit 16f40a5

Please sign in to comment.