Skip to content

Commit

Permalink
Added several additional services and moved some components to Contra…
Browse files Browse the repository at this point in the history
…cts project to make them independent from impl.

Added interfaces for some Models (IProjectItem a.e)
  • Loading branch information
StefanKert committed Mar 11, 2019
1 parent 83b9de1 commit b97a25d
Show file tree
Hide file tree
Showing 36 changed files with 648 additions and 667 deletions.
7 changes: 4 additions & 3 deletions src/BuildVision.Contracts/BuildErrorRaisedEventArgs.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
using System;
using BuildVision.UI.Models;

namespace BuildVision.Contracts
{
public class BuildErrorRaisedEventArgs : EventArgs
{
public ErrorLevel ErrorLevel { get; private set; }
public BuildedProject ProjectInfo { get; private set; }
public IProjectItem ProjectInfo { get; private set; }

public BuildErrorRaisedEventArgs(ErrorLevel errorLevel, BuildedProject projectInfo)
public BuildErrorRaisedEventArgs(ErrorLevel errorLevel, IProjectItem projectInfo)
{
ErrorLevel = errorLevel;
ProjectInfo = projectInfo;
}
}
}
}
11 changes: 8 additions & 3 deletions src/BuildVision.Contracts/BuildVision.Contracts.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Build.Framework" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.Serialization" />
Expand All @@ -49,19 +50,23 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Models\BuildedProjectsCollection.cs" />
<Compile Include="Models\BuildProjectContextEntry.cs" />
<Compile Include="Enums\BuildResultState.cs" />
<Compile Include="Enums\BuildActions.cs" />
<Compile Include="BuildedProject.cs" />
<Compile Include="Models\BuildedProject.cs" />
<Compile Include="BuildErrorRaisedEventArgs.cs" />
<Compile Include="BuildOutputFileTypes.cs" />
<Compile Include="Enums\BuildScopes.cs" />
<Compile Include="Enums\BuildState.cs" />
<Compile Include="Enums\ColumnsOrder.cs" />
<Compile Include="ErrorItem.cs" />
<Compile Include="Models\BuildProjectEventArgs.cs" />
<Compile Include="Models\ErrorItem.cs" />
<Compile Include="Enums\ErrorLevel.cs" />
<Compile Include="ErrorsBox.cs" />
<Compile Include="Models\ErrorsBox.cs" />
<Compile Include="Enums\ProjectState.cs" />
<Compile Include="Models\IBuildInformationModel.cs" />
<Compile Include="Models\IProjectItem.cs" />
<Compile Include="Models\ISolutionModel.cs" />
<Compile Include="ProjectNotFoundException.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class BuildProjectContextEntry

public IDictionary<string, string> Properties { get; set; }

public ProjectItem ProjectItem { get; set; }
public IProjectItem ProjectItem { get; set; }

public bool IsInvalid { get; set; }

Expand All @@ -25,4 +25,4 @@ public BuildProjectContextEntry(int instanceId, int contextId, string fileName,
Properties = properties;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ namespace BuildVision.UI.Contracts
{
public class BuildProjectEventArgs : EventArgs
{
public ProjectItem ProjectItem { get; private set; }
public IProjectItem ProjectItem { get; private set; }
public ProjectState ProjectState { get; private set; }
public DateTime EventTime { get; private set; }
public BuildedProject BuildedProjectInfo { get; private set; }

public BuildProjectEventArgs(ProjectItem projectItem, ProjectState projectState, DateTime eventTime, BuildedProject buildedProjectInfo)
public BuildProjectEventArgs(IProjectItem projectItem, ProjectState projectState, DateTime eventTime, BuildedProject buildedProjectInfo)
{
ProjectItem = projectItem;
ProjectState = projectState;
EventTime = eventTime;
BuildedProjectInfo = buildedProjectInfo;
}
}
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace BuildVision.UI.Contracts
{
public class BuildedProjectsCollection : List<ProjectItem>
public class BuildedProjectsCollection : List<IProjectItem>
{
public int BuildSuccessCount => this.Count(p => p.Success == true && p.State != ProjectState.BuildWarning && p.State != ProjectState.UpToDate);
public int BuildErrorCount => this.Count(p => p.Success == false);
Expand All @@ -16,7 +16,7 @@ public class BuildedProjectsCollection : List<ProjectItem>

public bool BuildWithoutErrors => this.All(p => p.Success == null || p.Success == true);

public ProjectItem this[ProjectItem pi]
public IProjectItem this[IProjectItem pi]
{
get
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,9 @@ public string FileName

public string Message { get; set; }

public Action GoToError { get; }

public ErrorItem(ErrorLevel errorLevel, Action<ErrorItem> goToError)
public ErrorItem(ErrorLevel errorLevel)
{
Level = errorLevel;
GoToError = () => goToError(this);
}

public ErrorItem() { }
Expand Down
File renamed without changes.
39 changes: 39 additions & 0 deletions src/BuildVision.Contracts/Models/IProjectItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System;
using System.Windows.Controls;
using BuildVision.Contracts;

namespace BuildVision.UI.Models
{
public interface IProjectItem
{
TimeSpan? BuildElapsedTime { get; }
DateTime? BuildFinishTime { get; set; }
int? BuildOrder { get; set; }
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; }
string FullName { get; set; }
string FullPath { get; set; }
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; }
string RootNamespace { get; set; }
string SolutionFolder { get; set; }
ProjectState State { get; set; }
ControlTemplate StateBitmap { get; }
bool Success { get; set; }
string UniqueName { get; set; }
int WarningsCount { get; }

void RaiseBuildElapsedTimeChanged();
}
}
9 changes: 9 additions & 0 deletions src/BuildVision.Exports/Factories/IBuildMessagesFactory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace BuildVision.Exports.Factories
{
public interface IBuildMessagesFactory
{
string GetBuildBeginExtraMessage();
string GetBuildBeginMajorMessage();
string GetBuildDoneMessage();
}
}
16 changes: 16 additions & 0 deletions src/BuildVision.Exports/IBuildOutputLogger.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using BuildVision.Contracts;
using BuildVision.UI.Contracts;
using BuildVision.UI.Models;

namespace BuildVision.Exports
{
public interface IBuildOutputLogger
{
bool IsProjectUpToDate(IProjectItem projectItem);

void Attach();

event Action<BuildProjectContextEntry, object, ErrorLevel> OnErrorRaised;
}
}
15 changes: 15 additions & 0 deletions src/BuildVision.Exports/Providers/IBuildingProjectsProvider.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System.Collections.ObjectModel;
using BuildVision.UI.Contracts;
using BuildVision.UI.Models;

namespace BuildVision.Exports.Providers
{
public interface IBuildingProjectsProvider
{
ObservableCollection<IProjectItem> GetBuildingProjects();
void ProjectBuildStarted(IProjectItem projectItem, uint dwAction);
void ProjectBuildFinished(string projectIdentifier, bool succeess, bool canceled);
void ReloadCurrentProjects();
bool TryGetProjectItem(BuildProjectContextEntry projectEntry, out IProjectItem projectItem);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ public interface ISolutionProvider
{
ISolutionModel GetSolutionModel();
void ReloadSolution();
IEnumerable<ProjectItem> GetProjects();
IEnumerable<IProjectItem> GetProjects();
}
}
3 changes: 0 additions & 3 deletions src/BuildVision.UI/BuildVision.UI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,13 @@
<Compile Include="Components\ErrorsGrid.xaml.cs">
<DependentUpon>ErrorsGrid.xaml</DependentUpon>
</Compile>
<Compile Include="Contracts\BuildedProjectsCollection.cs" />
<Compile Include="Contracts\BuildProjectContextEntry.cs" />
<Compile Include="Settings\Models\ControlSettings.cs" />
<Compile Include="Settings\Models\GeneralSettings.cs" />
<Compile Include="Settings\Models\GridColumnSettings.cs" />
<Compile Include="Models\GridColumnSettingsCollection.cs" />
<Compile Include="Settings\Models\GridSettings.cs" />
<Compile Include="Helpers\BindingProxy.cs" />
<Compile Include="Helpers\BuildMessagesFactory.cs" />
<Compile Include="Contracts\BuildProjectEventArgs.cs" />
<Compile Include="Components\ControlView.xaml.cs">
<DependentUpon>ControlView.xaml</DependentUpon>
</Compile>
Expand Down
3 changes: 2 additions & 1 deletion src/BuildVision.UI/Components/ErrorsGrid.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ private void ErrorsGridRowOnMouseLeftButtonUp(object sender, MouseButtonEventArg
{
var row = (DataGridRow)sender;
var errorItem = (ErrorItem)row.Item;
errorItem.GoToError();
// TODO navigate to error
//errorItem.GoToError();
e.Handled = true;
}
catch (Exception ex)
Expand Down
Loading

0 comments on commit b97a25d

Please sign in to comment.