Skip to content

Add BHoM Information Version Button and Update Website Links #1310

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

Merged
merged 10 commits into from
Jan 30, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
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
50 changes: 50 additions & 0 deletions Revit_Core_Adapter/Listener/Buttons/BHoMVersion.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* This file is part of the Buildings and Habitats object Model (BHoM)
* Copyright (c) 2015 - 2022, the respective contributors. All rights reserved.
*
* Each contributor holds copyright over their respective contributions.
* The project versioning (Git) records all such contribution source information.
*
*
* The BHoM is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3.0 of the License, or
* (at your option) any later version.
*
* The BHoM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this code. If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
*/

using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using BH.Engine.UI;

namespace BH.Revit.Adapter.Core
{
[Transaction(TransactionMode.Manual)]
[Regeneration(RegenerationOption.Manual)]
public class BHoMVersion : IExternalCommand
{
/***************************************************/
/**** Public methods ****/
/***************************************************/

public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
var bHoMInformation = Query.Information();

TaskDialog.Show("BHoM Version", $"The current BHoM Version is: {bHoMInformation.Version}.");
return Result.Succeeded;
}

/***************************************************/
}
}


4 changes: 3 additions & 1 deletion Revit_Core_Adapter/Listener/Buttons/BHoMWebsite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using BH.Engine.UI;

namespace BH.Revit.Adapter.Core
{
Expand All @@ -36,7 +37,8 @@ public class BHoMWebsite : IExternalCommand

public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
System.Diagnostics.Process.Start("https://bhom.xyz/");
var bHoMInformation = Query.Information();
System.Diagnostics.Process.Start($"{bHoMInformation.BHoMWebsite}");
return Result.Succeeded;
}

Expand Down
4 changes: 3 additions & 1 deletion Revit_Core_Adapter/Listener/Buttons/BHoMWiki.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using BH.Engine.UI;

namespace BH.Revit.Adapter.Core
{
Expand All @@ -36,7 +37,8 @@ public class BHoMWiki : IExternalCommand

public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
System.Diagnostics.Process.Start("https://github.com/BHoM/documentation/wiki");
var bHoMInformation = Query.Information();
System.Diagnostics.Process.Start($"{bHoMInformation.WikiLink}");
return Result.Succeeded;
}

Expand Down
10 changes: 8 additions & 2 deletions Revit_Core_Adapter/Listener/RevitListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,9 @@ private void AddInfoButtons(UIControlledApplication uiControlledApp)

PushButtonData bHoMInfoButton = new PushButtonData("BHoM Wiki", "BHoM Wiki", System.Reflection.Assembly.GetExecutingAssembly().Location, typeof(RevitListener).Namespace + ".BHoMWiki");
PushButtonData bHoMWebsiteButton = new PushButtonData("bhom.xyz", "bhom.xyz", System.Reflection.Assembly.GetExecutingAssembly().Location, typeof(RevitListener).Namespace + ".BHoMWebsite");

List<PushButton> infoButtons = panel.AddStackedItems(bHoMInfoButton, bHoMWebsiteButton).Cast<PushButton>().ToList();
PushButtonData bHoMVersionButton = new PushButtonData("BHoM Version", "BHoM Version", System.Reflection.Assembly.GetExecutingAssembly().Location, typeof(RevitListener).Namespace + ".BHoMVersion");

List<PushButton> infoButtons = panel.AddStackedItems(bHoMInfoButton, bHoMWebsiteButton, bHoMVersionButton).Cast<PushButton>().ToList();
infoButtons[0].ToolTip = "Visit the BHoM Wiki page.";
infoButtons[0].Image = new BitmapImage(new Uri(Path.Combine(m_ResourceFolder, "Info16.png")));
infoButtons[0].Enabled = true;
Expand All @@ -458,6 +459,11 @@ private void AddInfoButtons(UIControlledApplication uiControlledApp)
infoButtons[1].Enabled = true;
infoButtons[1].Visible = true;
infoButtons[1].AvailabilityClassName = alwaysAvailable;
infoButtons[2].ToolTip = "Get current installed BHoM version.";
infoButtons[2].Image = new BitmapImage(new Uri(Path.Combine(m_ResourceFolder, "Info16.png")));
infoButtons[2].Enabled = true;
infoButtons[2].Visible = true;
infoButtons[2].AvailabilityClassName = alwaysAvailable;
}

/***************************************************/
Expand Down
7 changes: 6 additions & 1 deletion Revit_Core_Adapter/Revit_Core_Adapter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,13 @@
</Reference>
<Reference Include="System.Windows.Forms" />
<Reference Include="PresentationCore" />
<Reference Include="UI_Engine">
<HintPath>C:\ProgramData\BHoM\Assemblies\UI_Engine.dll</HintPath>
</Reference>
<Reference Include="UI_oM">
<HintPath>C:\ProgramData\BHoM\Assemblies\UI_oM.dll</HintPath>
</Reference>
</ItemGroup>

<ItemGroup>
<None Include="Listener\Files\BHoM_2018.Addin">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
Expand Down