Skip to content

Commit 9d40804

Browse files
author
Fraser Greenroyd
authored
Introduce settings options within the UI framework (#482)
2 parents b40e1d0 + 8ed1988 commit 9d40804

File tree

14 files changed

+876
-8
lines changed

14 files changed

+876
-8
lines changed

BHoM_UI.sln

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 15
4-
VisualStudioVersion = 15.0.28307.1169
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.9.34616.47
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BHoM_UI", "BHoM_UI\BHoM_UI.csproj", "{69F4F042-E23A-4673-AB32-3D787CFA976C}"
77
EndProject
@@ -12,6 +12,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UI_Engine", "UI_Engine\UI_E
1212
{50D4C1ED-C16C-4365-A742-938BF49EC4B0} = {50D4C1ED-C16C-4365-A742-938BF49EC4B0}
1313
EndProjectSection
1414
EndProject
15+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BHoM_Windows_UI", "BHoM_Windows_UI\BHoM_Windows_UI.csproj", "{9BA156D1-851D-4267-A94F-6F238D17B634}"
16+
EndProject
1517
Global
1618
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1719
Debug|Any CPU = Debug|Any CPU
@@ -30,6 +32,10 @@ Global
3032
{565DDBD0-5C04-4BE9-B57D-CE54C2124ABB}.Debug|Any CPU.Build.0 = Debug|Any CPU
3133
{565DDBD0-5C04-4BE9-B57D-CE54C2124ABB}.Release|Any CPU.ActiveCfg = Release|Any CPU
3234
{565DDBD0-5C04-4BE9-B57D-CE54C2124ABB}.Release|Any CPU.Build.0 = Release|Any CPU
35+
{9BA156D1-851D-4267-A94F-6F238D17B634}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
36+
{9BA156D1-851D-4267-A94F-6F238D17B634}.Debug|Any CPU.Build.0 = Debug|Any CPU
37+
{9BA156D1-851D-4267-A94F-6F238D17B634}.Release|Any CPU.ActiveCfg = Release|Any CPU
38+
{9BA156D1-851D-4267-A94F-6F238D17B634}.Release|Any CPU.Build.0 = Release|Any CPU
3339
EndGlobalSection
3440
GlobalSection(SolutionProperties) = preSolution
3541
HideSolutionNode = FALSE

BHoM_UI/Global/GlobalSearch.cs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,20 @@ private static void M_SearchMenu_Disposed(object sender, EventArgs e)
155155

156156
private static void ShowWithConstraint(SearchConfig config)
157157
{
158+
var settings = BH.Engine.Settings.Query.GetSettings(typeof(BH.oM.UI.SearchSettings)) as SearchSettings;
159+
List<string> excludedToolkits = new List<string>();
160+
if (settings != null)
161+
excludedToolkits = settings.Toolkits.Where(x => !x.Include).Select(x => x.Toolkit).ToList();
162+
158163
if (config != null)
159164
{
160-
m_SearchMenu.PossibleItems = m_PossibleItems.Select(x =>
165+
m_SearchMenu.PossibleItems = m_PossibleItems.Where(x =>
166+
{
167+
if (excludedToolkits.Any(y => x.Text.Contains(y)))
168+
return false;
169+
170+
return true; //If the text does not contain any of the excluded toolkits then include it in this display
171+
}).Select(x =>
161172
{
162173
SearchItem withWeight = x.ShallowClone() as SearchItem;
163174
withWeight.Weight = withWeight.Weight(config);
@@ -166,7 +177,13 @@ private static void ShowWithConstraint(SearchConfig config)
166177
}
167178
else
168179
{
169-
m_SearchMenu.PossibleItems = m_PossibleItems;
180+
m_SearchMenu.PossibleItems = m_PossibleItems.Where(x =>
181+
{
182+
if (excludedToolkits.Any(y => x.Text.Contains(y)))
183+
return false;
184+
185+
return true; //If the text does not contain any of the excluded toolkits then include it in this display
186+
}).ToList();
170187
}
171188

172189
m_SearchMenu.HitsOnEmptySearch = config != null;
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{9BA156D1-851D-4267-A94F-6F238D17B634}</ProjectGuid>
8+
<OutputType>Library</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>BH.UI.Base.Windows</RootNamespace>
11+
<AssemblyName>BHoM_Windows_UI</AssemblyName>
12+
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
<Deterministic>true</Deterministic>
15+
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17+
<DebugSymbols>true</DebugSymbols>
18+
<DebugType>full</DebugType>
19+
<Optimize>false</Optimize>
20+
<OutputPath>..\Build\</OutputPath>
21+
<DefineConstants>DEBUG;TRACE</DefineConstants>
22+
<ErrorReport>prompt</ErrorReport>
23+
<WarningLevel>4</WarningLevel>
24+
</PropertyGroup>
25+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26+
<DebugType>pdbonly</DebugType>
27+
<Optimize>true</Optimize>
28+
<OutputPath>..\Build\</OutputPath>
29+
<DefineConstants>TRACE</DefineConstants>
30+
<ErrorReport>prompt</ErrorReport>
31+
<WarningLevel>4</WarningLevel>
32+
</PropertyGroup>
33+
<ItemGroup>
34+
<Reference Include="BHoM">
35+
<HintPath>$(ProgramData)\BHoM\Assemblies\BHoM.dll</HintPath>
36+
<Private>False</Private>
37+
<SpecificVersion>False</SpecificVersion>
38+
</Reference>
39+
<Reference Include="BHoM_Engine">
40+
<HintPath>$(ProgramData)\BHoM\Assemblies\BHoM_Engine.dll</HintPath>
41+
<Private>False</Private>
42+
<SpecificVersion>False</SpecificVersion>
43+
</Reference>
44+
<Reference Include="PresentationCore" />
45+
<Reference Include="PresentationFramework" />
46+
<Reference Include="Settings_Engine">
47+
<HintPath>$(ProgramData)\BHoM\Assemblies\Settings_Engine.dll</HintPath>
48+
<Private>False</Private>
49+
<SpecificVersion>False</SpecificVersion>
50+
</Reference>
51+
<Reference Include="System" />
52+
<Reference Include="System.Core" />
53+
<Reference Include="System.Drawing" />
54+
<Reference Include="System.Xaml" />
55+
<Reference Include="System.Xml.Linq" />
56+
<Reference Include="System.Data.DataSetExtensions" />
57+
<Reference Include="Microsoft.CSharp" />
58+
<Reference Include="System.Data" />
59+
<Reference Include="System.Net.Http" />
60+
<Reference Include="System.Xml" />
61+
<Reference Include="WindowsBase" />
62+
</ItemGroup>
63+
<ItemGroup>
64+
<Compile Include="Interface\ISettingsWindow.cs" />
65+
<Compile Include="Properties\AssemblyInfo.cs" />
66+
<Compile Include="Properties\Resources.Designer.cs">
67+
<AutoGen>True</AutoGen>
68+
<DesignTime>True</DesignTime>
69+
<DependentUpon>Resources.resx</DependentUpon>
70+
</Compile>
71+
<Compile Include="Settings\SearchSettingsWindow.xaml.cs">
72+
<DependentUpon>SearchSettingsWindow.xaml</DependentUpon>
73+
</Compile>
74+
<Compile Include="ViewModel\ToolkitSelectItemModel.cs" />
75+
</ItemGroup>
76+
<ItemGroup>
77+
<Page Include="Settings\SearchSettingsWindow.xaml">
78+
<SubType>Designer</SubType>
79+
<Generator>MSBuild:Compile</Generator>
80+
</Page>
81+
</ItemGroup>
82+
<ItemGroup>
83+
<ProjectReference Include="..\UI_oM\UI_oM.csproj">
84+
<Project>{50d4c1ed-c16c-4365-a742-938bf49ec4b0}</Project>
85+
<Name>UI_oM</Name>
86+
</ProjectReference>
87+
</ItemGroup>
88+
<ItemGroup>
89+
<EmbeddedResource Include="Properties\Resources.resx">
90+
<Generator>ResXFileCodeGenerator</Generator>
91+
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
92+
</EmbeddedResource>
93+
</ItemGroup>
94+
<ItemGroup>
95+
<Resource Include="Resources\BHoM_Logo.png" />
96+
</ItemGroup>
97+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
98+
<PropertyGroup>
99+
<PostBuildEvent>xcopy "$(TargetDir)$(TargetFileName)" "$(ProgramData)\BHoM\Assemblies" /Y</PostBuildEvent>
100+
</PropertyGroup>
101+
</Project>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* This file is part of the Buildings and Habitats object Model (BHoM)
3+
* Copyright (c) 2015 - 2024, the respective contributors. All rights reserved.
4+
*
5+
* Each contributor holds copyright over their respective contributions.
6+
* The project versioning (Git) records all such contribution source information.
7+
*
8+
*
9+
* The BHoM is free software: you can redistribute it and/or modify
10+
* it under the terms of the GNU Lesser General Public License as published by
11+
* the Free Software Foundation, either version 3.0 of the License, or
12+
* (at your option) any later version.
13+
*
14+
* The BHoM is distributed in the hope that it will be useful,
15+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
* GNU Lesser General Public License for more details.
18+
*
19+
* You should have received a copy of the GNU Lesser General Public License
20+
* along with this code. If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
21+
*/
22+
23+
using System;
24+
using System.Collections.Generic;
25+
using System.Linq;
26+
using System.Text;
27+
using System.Threading.Tasks;
28+
29+
namespace BH.UI.Base.Windows
30+
{
31+
public interface ISettingsWindow
32+
{
33+
void OnPopUpClose();
34+
}
35+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
* This file is part of the Buildings and Habitats object Model (BHoM)
3+
* Copyright (c) 2015 - 2024, the respective contributors. All rights reserved.
4+
*
5+
* Each contributor holds copyright over their respective contributions.
6+
* The project versioning (Git) records all such contribution source information.
7+
*
8+
*
9+
* The BHoM is free software: you can redistribute it and/or modify
10+
* it under the terms of the GNU Lesser General Public License as published by
11+
* the Free Software Foundation, either version 3.0 of the License, or
12+
* (at your option) any later version.
13+
*
14+
* The BHoM is distributed in the hope that it will be useful,
15+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
* GNU Lesser General Public License for more details.
18+
*
19+
* You should have received a copy of the GNU Lesser General Public License
20+
* along with this code. If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
21+
*/
22+
23+
using System.Reflection;
24+
using System.Runtime.CompilerServices;
25+
using System.Runtime.InteropServices;
26+
27+
// General Information about an assembly is controlled through the following
28+
// set of attributes. Change these attribute values to modify the information
29+
// associated with an assembly.
30+
[assembly: AssemblyTitle("BHoM_Windows_UI")]
31+
[assembly: AssemblyDescription("https://github.com/BHoM/BHoM_UI")]
32+
[assembly: AssemblyConfiguration("")]
33+
[assembly: AssemblyCompany("BuroHappold Engineering")]
34+
[assembly: AssemblyProduct("BHoM_Windows_UI")]
35+
[assembly: AssemblyCopyright("Copyright © BuroHappold Engineering 2024")]
36+
[assembly: AssemblyTrademark("")]
37+
[assembly: AssemblyCulture("")]
38+
39+
// Setting ComVisible to false makes the types in this assembly not visible
40+
// to COM components. If you need to access a type in this assembly from
41+
// COM, set the ComVisible attribute to true on that type.
42+
[assembly: ComVisible(false)]
43+
44+
// The following GUID is for the ID of the typelib if this project is exposed to COM
45+
[assembly: Guid("9ba156d1-851d-4267-a94f-6f238d17b634")]
46+
47+
// Version information for an assembly consists of the following four values:
48+
//
49+
// Major Version
50+
// Minor Version
51+
// Build Number
52+
// Revision
53+
//
54+
// You can specify all the values or you can default the Build and Revision Numbers
55+
// by using the '*' as shown below:
56+
// [assembly: AssemblyVersion("1.0.*")]
57+
[assembly: AssemblyVersion("7.0.0.0")]
58+
[assembly: AssemblyFileVersion("7.1.0.0")]

BHoM_Windows_UI/Properties/Resources.Designer.cs

Lines changed: 95 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)