Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving to AsyncPackage #71

Merged
merged 101 commits into from
Feb 15, 2020
Merged
Changes from 1 commit
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
00d158e
Starting development for 3.0.0
StefanKert Dec 23, 2018
7b68ef6
Dropping support for vs2013
StefanKert Dec 23, 2018
55c7f2d
Removing third party nuget packages and replace with Microsoft packages
StefanKert Dec 23, 2018
3bb9a5d
update to make use of asyncpackage
StefanKert Dec 27, 2018
70932b1
Further major refactorings.
StefanKert Jan 4, 2019
3a680f8
Added further extension methods to make them more readable.
StefanKert Jan 7, 2019
0b1f15d
Further improvement for several entities. Starting to move to IVsUpda…
StefanKert Jan 14, 2019
f227aa9
Fixed integrationtests
StefanKert Mar 8, 2019
645cf64
Next steps to a cleaner structure
StefanKert Mar 9, 2019
83b9de1
Introducing several services
StefanKert Mar 9, 2019
b97a25d
Added several additional services and moved some components to Contra…
StefanKert Mar 11, 2019
f4ccea4
Moved some controls and components to separate classes
StefanKert Mar 16, 2019
edfb460
Further cleanup
StefanKert Mar 16, 2019
c284def
Additional fixes.
StefanKert Mar 16, 2019
d93ece9
Reorganizing generic.xaml
StefanKert Mar 18, 2019
d7d1747
Some minor refactorings
StefanKert Mar 19, 2019
09983f2
Added Description parameter
StefanKert Mar 19, 2019
9fbfd93
Using common xaml for indicators
StefanKert Mar 19, 2019
ed47ff2
Removed further inused classes.
StefanKert Mar 20, 2019
4eda9df
Bring back BuildVision ToolWindow
StefanKert Mar 20, 2019
cbb7d32
Adding vstest console runner
StefanKert Mar 21, 2019
259979c
Separated unittests and integrationtests into two steps
StefanKert Mar 21, 2019
f6da48d
Wildcards to include subdirectories
StefanKert Mar 21, 2019
48247fa
No need to build develop
StefanKert Mar 21, 2019
334f6c2
Added xunit 2.4.1 and description for tests
StefanKert Mar 21, 2019
c5357eb
installing vstest
StefanKert Mar 21, 2019
a5bf96f
Uninstalled mstestadapter
StefanKert Mar 21, 2019
7dadb21
Invoke dotnet vstest directly
StefanKert Mar 21, 2019
8c1b82a
Using righ tname for assembly
StefanKert Mar 21, 2019
4208d10
Migrated common / contracts to new csproj
StefanKert Mar 21, 2019
2776e37
Using $(BuildConfiguration) for tests
StefanKert Mar 21, 2019
12c8e7c
Setting Exp flag
StefanKert Mar 21, 2019
fd16d33
Try to run on localmachine
StefanKert Mar 22, 2019
e99bd6e
Merge branch 'feature/asyncpackage' of https://github.com/stefankert/…
StefanKert Mar 22, 2019
d7c779e
Continue on failure nbgv install
StefanKert Mar 22, 2019
7651841
Using ui vs2017 build agent
StefanKert Mar 22, 2019
697e63b
Fixed packageloadtest
StefanKert Mar 22, 2019
2dc9a63
Using hosted agent agai
StefanKert Mar 22, 2019
16f40a5
Fixed issue with indicators
StefanKert Mar 23, 2019
06bf033
Moved some files to different places
StefanKert Mar 23, 2019
6d18526
Added back most of the ermoved functionalities
StefanKert Mar 23, 2019
46a8a8d
Additional cleanups and fixes
StefanKert Mar 23, 2019
0485750
Initial flow is working again.. needs much more cleanup but we are on…
StefanKert Mar 23, 2019
28b7bd3
Included error messages to projectgrid
StefanKert Mar 29, 2019
01d54f8
Fixed setting dialogs and furthe rthings
StefanKert Mar 30, 2019
d43a806
Removed unused channel .. maybe later
StefanKert Mar 30, 2019
c0d8a8b
Added global exceptionhandling
StefanKert Apr 5, 2019
08b6200
Reset current projects on rebuild
StefanKert Apr 5, 2019
00b0fe6
Fixed issue with progressbar
StefanKert Apr 5, 2019
0b6022e
Using metapackage
StefanKert Apr 5, 2019
0e8d802
Only navigate on errorlevel Error
StefanKert Apr 6, 2019
7b7d4a7
Using autload
StefanKert Apr 6, 2019
dcde1ae
Auto load after solution opened
StefanKert Apr 6, 2019
c5cc157
Using nuget pkg for ms build
StefanKert Apr 6, 2019
b0166af
Using outoload behaviour
StefanKert Apr 6, 2019
f4ae645
Loading in background
StefanKert Apr 6, 2019
fc16b7e
Using syncsolutiuon again
StefanKert Apr 6, 2019
afb62ac
Seems like toolwindow is working properly
StefanKert Apr 6, 2019
d81a0ae
MInor cleanup
StefanKert Apr 6, 2019
86897c2
Fixed cancel build error
StefanKert Apr 6, 2019
9e7f92d
Fixed cancel build issue
StefanKert Apr 6, 2019
51c606f
Hide pending items
StefanKert Apr 6, 2019
77e7aac
Smaller cleanups and fixes to sorting
StefanKert Apr 7, 2019
91f935e
Cleanup stuff
StefanKert Apr 12, 2019
901673d
Using new logging framework Serilog do trace errors more easily
StefanKert Apr 12, 2019
58a8042
Further cleanup
StefanKert Apr 12, 2019
82e540e
Fixed grouping
StefanKert Apr 13, 2019
cd18456
Updated nuget packages to latest versions
StefanKert Apr 27, 2019
8d9518c
Adaptions
StefanKert Apr 27, 2019
97cffaa
Adaptions
StefanKert Apr 27, 2019
c1cf87d
Fixed many compilation warnings
StefanKert Apr 27, 2019
764e267
Fixed some warnings
StefanKert Apr 27, 2019
6629963
Showing error if something fails at startup
StefanKert Apr 27, 2019
f78baaf
Use ObservableCollection again
StefanKert Apr 27, 2019
3962260
No need to display timestamp
StefanKert Apr 27, 2019
a14a6fb
Refresh columns after settings have changed
StefanKert Apr 27, 2019
7720135
Warning label for projects with warnings is now default
StefanKert Apr 27, 2019
9251aca
Fixed issue with buildvision breaking on breaking build
StefanKert Apr 27, 2019
125ee49
Added option to opt out participating in telemetry. Building multiple…
StefanKert Apr 27, 2019
77de19d
Fixed yaml buildscript
StefanKert Apr 27, 2019
5c3c62f
once again.. to less whitespaces
StefanKert Apr 27, 2019
d1eb541
added build configs
StefanKert Apr 27, 2019
63b4efb
Added initial event
StefanKert Apr 27, 2019
b8ee8a5
Added preview icon
StefanKert Apr 27, 2019
a38259f
Do not track roleinstance and rolename
StefanKert Apr 27, 2019
ea508d5
Flush diagnostics client
StefanKert Apr 27, 2019
f4de254
Resolved most of the warnings in codefactor
StefanKert Apr 27, 2019
3519228
Added back instrumentationkey
StefanKert Apr 27, 2019
b1b0530
Add basic tracing for builds
StefanKert Apr 27, 2019
edc8082
fixed build
StefanKert Apr 27, 2019
393c29b
Updating order of elements
StefanKert Jul 5, 2019
8fd3995
Returning right number for warned projects
StefanKert Jul 5, 2019
10838b8
Fixed double parantheses (as proposed by toughengineer thanks :))
StefanKert Jul 5, 2019
13eb0fa
Fixed contextmenu checkboxes. Settings are now refreshed if the check…
StefanKert Jul 5, 2019
74ff988
Cleanup
StefanKert Oct 4, 2019
bae30e6
Fixed some performance issues
StefanKert Oct 4, 2019
3da540b
Several fixes
StefanKert Oct 5, 2019
3df9af8
removed logging
StefanKert Oct 5, 2019
9b03434
Do not use reflection for sorting
StefanKert Oct 5, 2019
f316dcf
Removed some things from projectitem
StefanKert Oct 6, 2019
3ea37b7
Fixed errorlist
StefanKert Oct 21, 2019
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
Prev Previous commit
Next Next commit
Additional fixes.
Moved Projectgrid to seperate usercontrol
StefanKert committed Mar 16, 2019
commit c284defd3e39bf0cd307f4e29916fcfc09c66656
Original file line number Diff line number Diff line change
@@ -3,7 +3,6 @@
public interface IBuildProgressViewModel
{
bool ActionProgressIsPaused { get; set; }
bool ActionProgressIsVisible { get; set; }
int CurrentQueuePosOfBuildingProject { get; }

void OnBuildBegin(int projectsCount);
7 changes: 7 additions & 0 deletions src/BuildVision.UI/BuildVision.UI.csproj
Original file line number Diff line number Diff line change
@@ -73,6 +73,9 @@
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Components\ProjectGrid.xaml.cs">
<DependentUpon>ProjectGrid.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\BuildVisionProgressBar.xaml.cs">
<DependentUpon>BuildVisionProgressBar.xaml</DependentUpon>
</Compile>
@@ -228,6 +231,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Components\ProjectGrid.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Components\SpinnerControl.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
303 changes: 7 additions & 296 deletions src/BuildVision.UI/Components/ControlView.xaml

Large diffs are not rendered by default.

81 changes: 1 addition & 80 deletions src/BuildVision.UI/Components/ControlView.xaml.cs
Original file line number Diff line number Diff line change
@@ -37,31 +37,11 @@ public ControlView()
//Grid.TargetUpdated += GridOnTargetUpdated;
}

private void GridOnTargetUpdated(object sender, DataTransferEventArgs e)
{
if (e.Property.Name == "ItemsSource")
RefreshSortDirectionInGrid();
}

private void RefreshSortDirectionInGrid()
{
//DataGridColumn dataGridColumn = Grid.Columns.FirstOrDefault(col => col.GetBindedProperty() == _viewModel.GridSortDescription.Property);
//if (dataGridColumn != null)
// dataGridColumn.SortDirection = _viewModel.GridSortDescription.Order.ToSystem();
}

private void GridOnSorting(object sender, DataGridSortingEventArgs e)
{
if (_viewModel.GridSorting.CanExecute(e))
_viewModel.GridSorting.Execute(e);
}

private void OnDataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
{
Debug.Assert(DataContext != null);

_viewModel = (BuildVisionPaneViewModel)DataContext;
//_viewModel.SetGridColumnsRef(Grid.Columns);
_viewModel = (BuildVisionPaneViewModel) DataContext;
_viewModel.PropertyChanged += ViewModelOnPropertyChanged;
}

@@ -78,64 +58,5 @@ private void ViewModelOnPropertyChanged(object sender, PropertyChangedEventArgs
//}
}

private void DataGridExpanderOnExpanded(object sender, RoutedEventArgs e)
{
ExpanderIsExpandedConverter.SaveState(
(Expander)sender,
false,
_viewModel.ControlSettings.GridSettings.CollapsedGroups);
e.Handled = true;
}

private void DataGridExpanderOnCollapsed(object sender, RoutedEventArgs e)
{
ExpanderIsExpandedConverter.SaveState(
(Expander)sender,
true,
_viewModel.ControlSettings.GridSettings.CollapsedGroups);
e.Handled = true;
}

// Send scrolling to the DataGrid.
private void DataGridExpanderOnPreviewMouseWheel(object sender, MouseWheelEventArgs e)
{
e.Handled = true;
var eventArg = new MouseWheelEventArgs(e.MouseDevice, e.Timestamp, e.Delta)
{
RoutedEvent = MouseWheelEvent,
Source = sender
};

var parent = (UIElement)VisualTreeHelper.GetParent((DependencyObject)sender);
parent.RaiseEvent(eventArg);
}

private void DataGridRowDetailsOnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
// http://stackoverflow.com/questions/6279724/mousedoubleclick-events-dont-bubble/6326181#6326181)
if (e.ClickCount == 2)
e.Handled = true;
}

// Autofocus for RowDetails (without extra mouse click).
private void DataGridRowOnPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
var row = (DataGridRow)sender;
if (!row.IsSelected && e.Source is DataGridDetailsPresenter)
{
row.Focusable = true;
row.Focus();

// Gets the element with keyboard focus.
var elementWithFocus = Keyboard.FocusedElement as UIElement;

// Change keyboard focus.
if (elementWithFocus != null)
{
var request = new TraversalRequest(FocusNavigationDirection.Next);
elementWithFocus.MoveFocus(request);
}
}
}
}
}
333 changes: 333 additions & 0 deletions src/BuildVision.UI/Components/ProjectGrid.xaml

Large diffs are not rendered by default.

136 changes: 136 additions & 0 deletions src/BuildVision.UI/Components/ProjectGrid.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
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;
using BuildVision.UI.Converters;
using BuildVision.UI.ViewModels;

namespace BuildVision.UI.Components
{
/// <summary>
/// Interaction logic for ProjectGrid.xaml
/// </summary>
public partial class ProjectGrid : UserControl
{
private BuildVisionPaneViewModel _viewModel;

public ProjectGrid()
{
InitializeComponent();
}

private void GridOnTargetUpdated(object sender, DataTransferEventArgs e)
{
if (e.Property.Name == "ItemsSource")
RefreshSortDirectionInGrid();
}

private void RefreshSortDirectionInGrid()
{
//DataGridColumn dataGridColumn = Grid.Columns.FirstOrDefault(col => col.GetBindedProperty() == _viewModel.GridSortDescription.Property);
//if (dataGridColumn != null)
// dataGridColumn.SortDirection = _viewModel.GridSortDescription.Order.ToSystem();
}

private void GridOnSorting(object sender, DataGridSortingEventArgs e)
{
if (_viewModel.GridSorting.CanExecute(e))
_viewModel.GridSorting.Execute(e);
}

private void OnDataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
{
//Debug.Assert(DataContext != null);

_viewModel = (BuildVisionPaneViewModel) DataContext;
//_viewModel.SetGridColumnsRef(Grid.Columns);
//_viewModel.PropertyChanged += ViewModelOnPropertyChanged;
}

private void ViewModelOnPropertyChanged(object sender, PropertyChangedEventArgs e)
{
//TODO implement logic for scrolling tu currentproject
//if (_viewModel.CurrentProject != null && e.PropertyName == "CurrentProject")
//{
// // TODO: Remove SelectedIndex = -1 and implement Unselect row feature by clicking on selected row.
// Grid.SelectedIndex = -1;

// if (Grid.SelectedIndex == -1)
// Grid.ScrollIntoView(_viewModel.CurrentProject);
//}
}

private void DataGridExpanderOnExpanded(object sender, RoutedEventArgs e)
{
ExpanderIsExpandedConverter.SaveState(
(Expander) sender,
false,
_viewModel.ControlSettings.GridSettings.CollapsedGroups);
e.Handled = true;
}

private void DataGridExpanderOnCollapsed(object sender, RoutedEventArgs e)
{
ExpanderIsExpandedConverter.SaveState(
(Expander) sender,
true,
_viewModel.ControlSettings.GridSettings.CollapsedGroups);
e.Handled = true;
}

// Send scrolling to the DataGrid.
private void DataGridExpanderOnPreviewMouseWheel(object sender, MouseWheelEventArgs e)
{
e.Handled = true;
var eventArg = new MouseWheelEventArgs(e.MouseDevice, e.Timestamp, e.Delta)
{
RoutedEvent = MouseWheelEvent,
Source = sender
};

var parent = (UIElement) VisualTreeHelper.GetParent((DependencyObject) sender);
parent.RaiseEvent(eventArg);
}

private void DataGridRowDetailsOnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
// http://stackoverflow.com/questions/6279724/mousedoubleclick-events-dont-bubble/6326181#6326181)
if (e.ClickCount == 2)
e.Handled = true;
}

// Autofocus for RowDetails (without extra mouse click).
private void DataGridRowOnPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
var row = (DataGridRow) sender;
if (!row.IsSelected && e.Source is DataGridDetailsPresenter)
{
row.Focusable = true;
row.Focus();

// Gets the element with keyboard focus.
var elementWithFocus = Keyboard.FocusedElement as UIElement;

// Change keyboard focus.
if (elementWithFocus != null)
{
var request = new TraversalRequest(FocusNavigationDirection.Next);
elementWithFocus.MoveFocus(request);
}
}
}
}
}
2 changes: 1 addition & 1 deletion src/BuildVision.UI/Models/BuildInformationModel.cs
Original file line number Diff line number Diff line change
@@ -56,7 +56,7 @@ public int WarnedProjectsCount
set => SetProperty(ref _warnedProjectsCount, value);
}

private string _stateMessage = "";
private string _stateMessage = Resources.BuildDoneText_BuildNotStarted;
public string StateMessage
{
get => _stateMessage;
6 changes: 3 additions & 3 deletions src/BuildVision.UI/Models/ProjectItem.cs
Original file line number Diff line number Diff line change
@@ -172,11 +172,11 @@ public ErrorsBox ErrorsBox
}
}

[GridColumn("ProjectItemHeader_ErrorsCount", ColumnsOrder.ErrorsCount, true, ImageDictionaryUri = "Resources/ValueIndicator.Resources.xaml", ImageKey = "ErrorsIndicator", ExampleValue = 4)]
[GridColumn("ProjectItemHeader_ErrorsCount", ColumnsOrder.ErrorsCount, true, ImageDictionaryUri = "Resources/ValueIndicator.Resources.xaml", ImageKey = "ErrorsIndicatorIcon", ExampleValue = 4)]
public int ErrorsCount => ErrorsBox.ErrorsCount;
[GridColumn("ProjectItemHeader_WarningsCount", ColumnsOrder.WarningsCount, true, ImageDictionaryUri = "Resources/ValueIndicator.Resources.xaml", ImageKey = "WarningsIndicator", ExampleValue = 1253)]
[GridColumn("ProjectItemHeader_WarningsCount", ColumnsOrder.WarningsCount, true, ImageDictionaryUri = "Resources/ValueIndicator.Resources.xaml", ImageKey = "WarningsIndicatorIcon", ExampleValue = 1253)]
public int WarningsCount => ErrorsBox.WarningsCount;
[GridColumn("ProjectItemHeader_MessagesCount", ColumnsOrder.MessagesCount, false, ImageDictionaryUri = "Resources/ValueIndicator.Resources.xaml", ImageKey = "MessagesIndicator", ExampleValue = 2)]
[GridColumn("ProjectItemHeader_MessagesCount", ColumnsOrder.MessagesCount, false, ImageDictionaryUri = "Resources/ValueIndicator.Resources.xaml", ImageKey = "MessagesIndicatorIcon", ExampleValue = 2)]
public int MessagesCount => ErrorsBox.MessagesCount;

private string _framework;
13 changes: 2 additions & 11 deletions src/BuildVision.UI/Styles/ControlViewStyle.xaml
Original file line number Diff line number Diff line change
@@ -32,17 +32,8 @@
</Style>

<Style x:Key="IndicatorLabel">

<Setter Property="Label.Foreground"
Value="{DynamicResource ToolWindowTextKey}" />

<Style.Triggers>
<DataTrigger Binding="{Binding IsEnabled}"
Value="false">
<Setter Property="Label.Opacity"
Value="0.4" />
</DataTrigger>
</Style.Triggers>
<Setter Property="Label.Foreground" Value="{DynamicResource ToolWindowTextKey}" />
<Setter Property="Label.Opacity" Value="0.4" />
</Style>

<converters1:BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter" />
9 changes: 6 additions & 3 deletions src/BuildVision.UI/Themes/Generic.xaml
Original file line number Diff line number Diff line change
@@ -64,13 +64,16 @@
</Style>

<Style TargetType="{x:Type ui:CancelButton}">
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="MinWidth" Value="66"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ui:CancelButton">
<Button Name="CleanSolutionButton"
ToolTip="{x:Static res:Resources.CleanSolutionButtonTooltip}">
<StackPanel Orientation="Horizontal">
<ContentControl Template="{StaticResource CancelBuildSolutionIcon}" />
<TextBlock Margin="2,0,0,0" Text="{x:Static res:Resources.CancelBuildSolutionButtonCaption}" />
</StackPanel>
<Button.Style>
<Style TargetType="Button" BasedOn="{StaticResource ToolBarButtonBaseStyle}" />
@@ -186,7 +189,7 @@
<Setter.Value>
<ControlTemplate TargetType="{x:Type indicators:ErrorsIndicator}">
<StackPanel Orientation="Vertical">
<Grid ToolTip="{x:Static res:Resources.ErrorsIndicator_Header}">
<Grid ToolTip="{x:Static res:Resources.ErrorsIndicator_Header}" ToolTipService.ShowOnDisabled="True">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
@@ -211,7 +214,7 @@
<Setter.Value>
<ControlTemplate TargetType="{x:Type indicators:WarningsIndicator}">
<StackPanel Orientation="Vertical">
<Grid ToolTip="{x:Static res:Resources.WarningsIndicator_Header}">
<Grid ToolTip="{x:Static res:Resources.WarningsIndicator_Header}" ToolTipService.ShowOnDisabled="True">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
@@ -236,7 +239,7 @@
<Setter.Value>
<ControlTemplate TargetType="{x:Type indicators:MessagesIndicator}">
<StackPanel Orientation="Vertical">
<Grid ToolTip="{x:Static res:Resources.MessagesIndicator_Header}">
<Grid ToolTip="{x:Static res:Resources.MessagesIndicator_Header}" ToolTipService.ShowOnDisabled="True">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
37 changes: 9 additions & 28 deletions src/BuildVision.UI/ViewModels/BuildProgressViewModel.cs
Original file line number Diff line number Diff line change
@@ -9,13 +9,14 @@
using BuildVision.UI.Models;
using BuildVision.UI.Settings.Models.BuildProgress;
using BuildVision.Contracts.Models;
using BuildVision.Contracts;

namespace BuildVision.UI.ViewModels
{
public class BuildProgressViewModel : BindableBase, IBuildProgressViewModel
{
private readonly ControlSettings _settings;

private readonly IBuildInformationModel _buildInformationModel;
private CancellationTokenSource _resetTaskBarInfoCts;

private int _projectsCount;
@@ -26,26 +27,13 @@ public class BuildProgressViewModel : BindableBase, IBuildProgressViewModel

private bool _actionProgressIsMarquee;

private bool _actionProgressIsError;


private readonly Lazy<TaskbarItemInfo> _taskbarItemInfo = new Lazy<TaskbarItemInfo>(() =>
{
var window = Application.Current.MainWindow;
return window.TaskbarItemInfo ?? (window.TaskbarItemInfo = new TaskbarItemInfo());
});
private TaskbarItemInfo TaskbarItemInfo => _taskbarItemInfo.Value;


private int _currentQueuePosOfBuildingProject;
public int CurrentQueuePosOfBuildingProject => _currentQueuePosOfBuildingProject;

private bool _actionProgressIsVisible;
public bool ActionProgressIsVisible
{
get => _actionProgressIsVisible;
set => SetProperty(ref _actionProgressIsVisible, value);
}
public int CurrentQueuePosOfBuildingProject { get; private set; }

private bool _actionProgressIsPaused;
public bool ActionProgressIsPaused
@@ -54,9 +42,10 @@ public bool ActionProgressIsPaused
set => SetProperty(ref _actionProgressIsPaused, value);
}

public BuildProgressViewModel(ControlSettings settings)
public BuildProgressViewModel(ControlSettings settings, IBuildInformationModel buildInformationModel)
{
_settings = settings;
_buildInformationModel = buildInformationModel;
}

private void UpdateTaskBarInfo()
@@ -66,13 +55,13 @@ private void UpdateTaskBarInfo()

TaskbarItemProgressState state;

if (!_actionProgressIsVisible)
if (_buildInformationModel.CurrentBuildState != BuildState.InProgress)
state = TaskbarItemProgressState.None;
else if (_actionProgressIsPaused)
state = TaskbarItemProgressState.Paused;
else if (_actionProgressIsMarquee)
state = TaskbarItemProgressState.Indeterminate;
else if (_actionProgressIsError)
else if (_buildInformationModel.CurrentBuildState == BuildState.Failed)
state = TaskbarItemProgressState.Error;
else
state = TaskbarItemProgressState.Normal;
@@ -107,12 +96,10 @@ public void OnBuildBegin(int projectsCount)
_incProgressValue = 0;
}

_currentQueuePosOfBuildingProject = 0;
CurrentQueuePosOfBuildingProject = 0;
_actionProgressValue = 0;
_actionProgressIsError = false;
_actionProgressIsMarquee = true;
ActionProgressIsPaused = false;
ActionProgressIsVisible = true;

UpdateTaskBarInfo();
}
@@ -129,15 +116,12 @@ public void OnBuildProjectBegin()
_actionProgressIsMarquee = true;
}

_currentQueuePosOfBuildingProject += 1;
CurrentQueuePosOfBuildingProject += 1;
UpdateTaskBarInfo();
}

public void OnBuildProjectDone(bool success)
{
if (!success)
_actionProgressIsError = true;

if (_projectsCount > 0)
{
_actionProgressIsMarquee = false;
@@ -156,10 +140,7 @@ public void OnBuildDone()
_actionProgressValue = 1;
_actionProgressIsMarquee = false;
UpdateTaskBarInfo();

ActionProgressIsVisible = false;
_actionProgressValue = 0;

ResetTaskBarInfoOnBuildDone();
}

14 changes: 10 additions & 4 deletions src/BuildVision.UI/ViewModels/BuildVisionPaneViewModel.cs
Original file line number Diff line number Diff line change
@@ -48,6 +48,8 @@ public bool HideUpToDateTargets

public ControlSettings ControlSettings { get; }

public ObservableCollection<IProjectItem> Projects { get; set; }

public IBuildInformationModel BuildInformationModel { get; set; }

public string GridGroupPropertyName
@@ -147,7 +149,7 @@ public ListCollectionView GroupedProjectsList
{
get
{
var groupedList = new ListCollectionView(new List<object>()); // todo use projects here ProjectsList);
var groupedList = new ListCollectionView(Projects); // todo use projects here ProjectsList);

if (!string.IsNullOrWhiteSpace(GridGroupPropertyName))
{
@@ -183,6 +185,7 @@ public DataGridHeadersVisibility GridHeadersVisibility

private ProjectItem _selectedProjectItem;
private readonly IBuildService _buildManager;
private readonly IBuildingProjectsProvider _buildingProjectsProvider;
private readonly IBuildInformationProvider _buildInformationProvider;

public ProjectItem SelectedProjectItem
@@ -192,14 +195,16 @@ public ProjectItem SelectedProjectItem
}

[ImportingConstructor]
public BuildVisionPaneViewModel(IBuildService buildManager, IBuildInformationProvider buildInformationProvider, IPackageSettingsProvider settingsProvider, ISolutionProvider solutionProvider)
public BuildVisionPaneViewModel(IBuildService buildManager, IBuildingProjectsProvider buildingProjectsProvider, IBuildInformationProvider buildInformationProvider, IPackageSettingsProvider settingsProvider, ISolutionProvider solutionProvider)
{
_buildManager = buildManager;
_buildingProjectsProvider = buildingProjectsProvider;
_buildInformationProvider = buildInformationProvider;
BuildInformationModel = _buildInformationProvider.GetBuildInformationModel();
BuildProgressViewModel = new BuildProgressViewModel(ControlSettings);
BuildProgressViewModel = new BuildProgressViewModel(ControlSettings, BuildInformationModel);
SolutionModel = solutionProvider.GetSolutionModel();
ControlSettings = settingsProvider.Settings;
Projects = _buildingProjectsProvider.GetBuildingProjects();
}

/// <summary>
@@ -208,9 +213,10 @@ public BuildVisionPaneViewModel(IBuildService buildManager, IBuildInformationPro
internal BuildVisionPaneViewModel()
{
ControlSettings = new ControlSettings();
BuildProgressViewModel = new BuildProgressViewModel(ControlSettings);
BuildInformationModel = new BuildInformationModel();
BuildProgressViewModel = new BuildProgressViewModel(ControlSettings, BuildInformationModel);
SolutionModel = new SolutionModel();
Projects = new ObservableCollection<IProjectItem>();
}

private void OpenContainingFolder()
2 changes: 1 addition & 1 deletion src/BuildVision/Core/BuildVisionPane.cs
Original file line number Diff line number Diff line change
@@ -77,7 +77,7 @@ async Task<BuildVisionPaneViewModel> InitializeAsync(AsyncPackage asyncPackage)
var packageSettingsProvider = await sp.GetServiceAsync(typeof(IPackageSettingsProvider)) as IPackageSettingsProvider;
Assumes.Present(packageSettingsProvider);

var viewModel = new BuildVisionPaneViewModel(buildService, buildInformationProvider, packageSettingsProvider, solutionProvider);
var viewModel = new BuildVisionPaneViewModel(buildService, buildingProjectsProvider, buildInformationProvider, packageSettingsProvider, solutionProvider);

View = CreateControlView();
View.DataContext = viewModel;