expose the current project and solution as properties on IHostApplicationWindow (used by build system)

This commit is contained in:
Michael Becker 2020-09-20 00:41:39 -04:00
parent 3d66a06827
commit a2f874a728
No known key found for this signature in database
GPG Key ID: 506F54899E2BFED7
3 changed files with 53 additions and 1 deletions

View File

@ -4,6 +4,8 @@ using System.Linq;
using System.Text;
using MBS.Framework.UserInterface;
using MBS.Framework.UserInterface.Controls.Docking;
using UniversalEditor.ObjectModels.Project;
using UniversalEditor.ObjectModels.Solution;
namespace UniversalEditor.UserInterface
{
@ -82,6 +84,9 @@ namespace UniversalEditor.UserInterface
void SetWindowListVisible(bool visible, bool modal);
StatusBar StatusBar { get; }
ProjectObjectModel CurrentProject { get; set; }
SolutionObjectModel CurrentSolution { get; set; }
}
public class IHostApplicationWindowCollection
: System.Collections.ObjectModel.Collection<IHostApplicationWindow>

View File

@ -1412,8 +1412,21 @@ namespace UniversalEditor.UserInterface
pnlSolutionExplorer.Solution = value;
}
}
public ProjectObjectModel CurrentProject
{
get
{
if (pnlSolutionExplorer.Project != null)
return pnlSolutionExplorer.Project;
return null;
}
set
{
pnlSolutionExplorer.Project = value;
}
}
#endregion
#endregion
public void ShowDocumentPropertiesDialog()
{

View File

@ -46,6 +46,40 @@ namespace UniversalEditor.UserInterface.Panels
}
}
public ProjectObjectModel Project
{
get
{
if (tvSolutionExplorer.SelectedRows.Count > 0)
{
TreeModelRow row = tvSolutionExplorer.SelectedRows[0];
while (row != null)
{
ProjectObjectModel proj = row.GetExtraData<ProjectObjectModel>("project");
if (proj != null)
return proj;
row = row.ParentRow;
}
}
else
{
if (Solution != null)
{
if (Solution.Projects.Count > 0)
{
return Solution.Projects[0];
}
}
}
return null;
}
set
{
}
}
private TreeModelRow LoadSolutionExplorerFolder(ObjectModels.Project.ProjectFolder fold)
{
TreeModelRow rowFolder = new TreeModelRow(new TreeModelRowColumn[]