Skip to content

Commit

Permalink
Updating order of elements
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanKert committed Jul 5, 2019
1 parent edc8082 commit 393c29b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using BuildVision.Contracts;
using BuildVision.Contracts.Models;
Expand All @@ -19,5 +20,7 @@ public interface IBuildInformationProvider
void BuildStarted(BuildAction currentBuildAction, BuildScope scope);
void BuildUpdate();
void ResetBuildInformationModel();

event Action BuildUpdated;
}
}
7 changes: 7 additions & 0 deletions src/BuildVision.UI/ViewModels/BuildVisionPaneViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Input;
using System.Windows.Threading;
using BuildVision.Common;
using BuildVision.Common.Logging;
using BuildVision.Contracts;
Expand All @@ -26,6 +27,7 @@
using BuildVision.UI.Settings.Models;
using BuildVision.Views.Settings;
using Microsoft.VisualStudio;
using Microsoft.VisualStudio.Threading;
using Serilog;
using Process = System.Diagnostics.Process;
using SortDescription = BuildVision.UI.Settings.Models.Sorting.SortDescription;
Expand Down Expand Up @@ -212,6 +214,11 @@ public BuildVisionPaneViewModel(
SolutionModel = solutionProvider.GetSolutionModel();
ControlSettings = settingsProvider.Settings;
Projects = _buildInformationProvider.Projects;

_buildInformationProvider.BuildUpdated += () =>
{
Application.Current.Dispatcher.BeginInvoke(new Action(() => OnPropertyChanged(nameof(GroupedProjectsList))));
};

_settingsProvider = settingsProvider;
_settingsProvider.SettingsChanged += () =>
Expand Down
6 changes: 5 additions & 1 deletion src/BuildVision/Services/BuildInformationProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using BuildVision.Common;
using BuildVision.Common.Diagnostics;
using BuildVision.Common.Logging;
Expand Down Expand Up @@ -212,7 +213,7 @@ public void BuildStarted(BuildAction buildAction, BuildScope buildScope)

_buildProcessCancellationToken = new CancellationTokenSource();
_windowStateService.ApplyToolWindowStateAction(_packageSettingsProvider.Settings.WindowSettings.WindowActionOnBuildBegin);
System.Threading.Tasks.Task.Run(() => Run(_buildProcessCancellationToken.Token), _buildProcessCancellationToken.Token);
Task.Run(() => Run(_buildProcessCancellationToken.Token), _buildProcessCancellationToken.Token);

string message = _buildMessagesFactory.GetBuildBeginMajorMessage(BuildInformationModel);
_statusBarNotificationService.ShowTextWithFreeze(message);
Expand Down Expand Up @@ -347,6 +348,7 @@ public void BuildUpdate()
{
project.RaiseBuildElapsedTimeChanged();
}
BuildUpdated?.Invoke();
}

public void BuildFinished(bool success, bool canceled)
Expand Down Expand Up @@ -428,5 +430,7 @@ public void BuildFinished(bool success, bool canceled)
}
}
}

public event Action BuildUpdated;
}
}

0 comments on commit 393c29b

Please sign in to comment.